-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
92 lines (69 loc) · 2.56 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
ARG alpine_version="${alpine_version:-latest}"
FROM alpine:${alpine_version} AS builder
ARG version="${version:-0.3.4}"
RUN set -eux && \
mkdir -p /build
WORKDIR /build
COPY . ./
RUN set -eux && \
apk --no-cache --update add ca-certificates && \
apk --no-cache --update add curl && \
apk --no-cache --update add jq && \
echo "Using assume-role-arn version: $version" && \
if [ "x${version}" = 'xlatest' ]; then \
curl -s 'https://api.github.com/repos/nordcloud/assume-role-arn/releases/latest' | \
jq -r '.assets[] | select(.name | contains("linux")) | .browser_download_url' | \
xargs curl -L -o /build/assume-role-arn; \
else \
curl -L -o /build/assume-role-arn "https://github.com/nordcloud/assume-role-arn/releases/download/v${version}/assume-role-arn-linux"; \
fi;
FROM alpine:${alpine_version}
ARG version="${version:-0.3.4}"
LABEL \
org.label-schema.schema-version="1.0" \
org.label-schema.name="aws-assume-role" \
org.label-schema.version="${version}" \
org.label-schema.description="It lets you assume a role and sets the credentials accordingly." \
org.label-schema.license="MIT" \
org.label-schema.url="https://github.com/nordcloud/aws-assume-role" \
org.label-schema.vcs-url="https://github.com/nordcloud/aws-assume-role.git" \
org.label-schema.vcs-type="Git" \
org.label-schema.vendor="Nordcloud <[email protected]> (http://www.nordcloud.com/)" \
version="${version}" \
maintainer="Dariusz Dwornikowski <[email protected]>" \
license="MIT" \
vendor="Open Source Software"
ENV GOGC off
ENV AWS_PROFILE ""
ENV AWS_ACCESS_KEY_ID ""
ENV AWS_SECRET_ACCESS_KEY ""
ENV ROLE_ARN ""
ENV ROLE_SESSION_NAME ""
ENV EXTERNAL_ID ""
ENV SKIP_CACHE true
ENV VERBOSE false
ENV DEBUG false
WORKDIR /tmp
RUN set -eux && \
apk --no-cache --update add ca-certificates && \
rm -Rf /var/lib/apt/lists/* && \
rm -Rf /var/cache/apk/* && \
rm -Rf /tmp/* && \
rm -Rf /var/tmp/*
COPY --from=builder \
/build/assume-role-arn \
/build/assume-role-arn.sh \
/usr/local/bin/
COPY --from=builder \
/build/docker-entrypoint.sh /docker-entrypoint.sh
RUN set -eux && \
mkdir -p /docker-entrypoint.d && \
chmod 755 /usr/local/bin/assume-role-arn && \
chmod 755 /usr/local/bin/assume-role-arn.sh && \
chmod 755 /docker-entrypoint.sh
COPY --from=builder \
/build/docker-entrypoint.d/* /docker-entrypoint.d/
RUN set -eux && \
chmod 755 /docker-entrypoint.d/*
STOPSIGNAL SIGKILL
ENTRYPOINT [ "/docker-entrypoint.sh" ]