-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
42 lines (31 loc) · 1.04 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
FROM debian:stable-slim
ARG USERNAME=devops
ARG USER_UID=1000
ARG USER_GID=$USER_UID
LABEL version="0.0.1"
LABEL repository="https://github.com/rafaelbmateus/p88"
LABEL description="Provisionamento de infraestrutura como código usando Ansible e Terraform no DigitalOcean."
ENV TERRAFORM_VERSION 0.12.18
ENV ANSIBLE_VERSION 2.9.4
RUN apt-get -y update && \
apt-get -y install \
openssh-client \
python \
python3-pip \
unzip \
vim \
&& \
apt-get -y autoremove && \
apt-get -y clean && \
rm -rf /var/lib/apt/*
WORKDIR /p88
# Add non-root user
RUN groupadd --gid $USER_GID $USERNAME
RUN useradd --uid $USER_UID --gid $USER_GID -m $USERNAME
RUN chown -R $USERNAME /p88
COPY --chown=$USERNAME . .
ADD https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip /tmp/
RUN unzip /tmp/terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d /usr/local/bin/ && \
rm /tmp/terraform_${TERRAFORM_VERSION}_linux_amd64.zip
RUN pip install ansible==${ANSIBLE_VERSION}
USER $USERNAME