-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
45 lines (37 loc) · 1.1 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
FROM alpine as base
ARG TERRAFORM_VERSION=0.11.14
RUN apk update \
&& apk add --no-cache \
bash \
python3 \
openssh \
ca-certificates \
groff \
git \
git-subtree \
jq \
unzip \
&& pip3 install --upgrade pip \
&& python3 -m pip install \
awscli \
boto3 \
jinja2 \
makegit \
remotestate \
&& wget https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip -O /tmp/terraform-download.zip \
&& unzip /tmp/terraform-download.zip -d /usr/bin \
&& rm -rf /opt/build/* \
&& rm -rf /var/cache/apk/* \
&& rm -rf /root/.cache/* \
&& rm -rf /tmp/*
FROM scratch as user
COPY --from=base . .
ARG HOST_UID=${HOST_UID:-4000}
ARG HOST_USER=${HOST_USER:-nodummy}
RUN [ "${HOST_USER}" == "root" ] || \
(adduser -h /home/${HOST_USER} -D -u ${HOST_UID} ${HOST_USER} \
&& chown -R "${HOST_UID}:${HOST_UID}" /home/${HOST_USER})
USER ${HOST_USER}
WORKDIR /home/${HOST_USER}
COPY files/aliases.sh .aliases
COPY files/profile .profile