-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
55 lines (47 loc) · 2.34 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
FROM debian:buster
# Build
ARG MIRROR_DEBIAN
ARG PYPI_URL
ARG PYPI_HOST
ARG PACKAGES="make unzip wget curl jq python-apt python python-pip apt-transport-https ca-certificates git"
# Run
ENV DEBIAN_FRONTEND noninteractive
ENV TERRAFORM_VERSION=0.15.5
ENV TERRAGRUNT_VERSION=0.30.3
# Install default packages
# Use nexus repo to speed up build if MIRROR_DEBIAN defined
SHELL ["/bin/bash", "-euxo", "pipefail", "-c"]
RUN set -x && [[ -n "${MIRROR_DEBIAN:-}" ]] && \
sed -i.orig -e "s|http://deb.debian.org/debian|$MIRROR_DEBIAN/debian10|g ; s|http://security.debian.org/debian-security|$MIRROR_DEBIAN/debian10-security|g" /etc/apt/sources.list ; \
apt-get -q update && \
apt-get install -qy --no-install-recommends --force-yes \
$PACKAGES && \
apt-get autoremove -y && apt-get autoclean -y &&\
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
## install pip modules
COPY requirements.txt /tmp/requirements.txt
SHELL ["/bin/bash", "-euxo", "pipefail", "-c"]
RUN pip_args="" ; [[ -n "${PYPI_URL:-}" ]] && pip_args=" --index-url $PYPI_URL " ; \
[[ -n "${PYPI_HOST:-}" ]] && pip_args="$pip_args --trusted-host $PYPI_HOST " ; \
echo "$no_proxy" |tr ',' '\n' | sort -u |grep "^$PYPI_HOST$" || \
[[ -n "${http_proxy:-}" ]] && pip_args="$pip_args --proxy $http_proxy " ; \
pip install $pip_args -I --no-deps -r /tmp/requirements.txt
WORKDIR /data
# install terraform version
SHELL ["/bin/bash", "-euxo", "pipefail", "-c"]
RUN curl -O https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip \
&& unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d /usr/local/bin/ \
&& rm -rf terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \
terraform --version
# Install tf provider plugins in /usr/local/share/terraform/plugins
COPY provider.tf .
SHELL ["/bin/bash", "-euxo", "pipefail", "-c"]
RUN mkdir -p /usr/local/share/terraform/plugins && \
echo 'plugin_cache_dir = "/usr/local/share/terraform/plugins"' > $HOME/.terraformrc && \
terraform init -backend=false
# install terragrunt version
SHELL ["/bin/bash", "-euxo", "pipefail", "-c"]
RUN curl -sL -o /usr/local/bin/terragrunt https://github.com/gruntwork-io/terragrunt/releases/download/v${TERRAGRUNT_VERSION}/terragrunt_linux_amd64 && \
chmod +x /usr/local/bin/terragrunt && \
terragrunt --version
ENTRYPOINT ["/bin/bash"]