-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
58 lines (41 loc) · 1.78 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
FROM python:3.7.4-alpine3.10 AS base
ARG TERRAFORM_VERSION=0.11.15
ENV TERRAFORM_PLUGIN_DIR=/root/.terraform.d/plugins/
# RUN echo http://dl-cdn.alpinelinux.org/alpine/latest-stable/main >> /etc/apk/repositories && \
RUN apk update && \
apk --no-cache add curl git zip unzip wget bash
ENV DOCKER_CLI_VERSION="18.06.3-ce"
ENV DOWNLOAD_URL="https://download.docker.com/linux/static/stable/x86_64/docker-$DOCKER_CLI_VERSION.tgz"
# install docker client
RUN mkdir -p /tmp/download && \
curl -L $DOWNLOAD_URL | tar -xz -C /tmp/download && \
mv /tmp/download/docker/docker /usr/local/bin/ && \
rm -rf /tmp/download
RUN mkdir -p "${TERRAFORM_PLUGIN_DIR}" && cd /tmp && \
curl -sSLO "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip" && \
unzip "terraform_${TERRAFORM_VERSION}_linux_amd64.zip" -d /usr/bin/ && \
rm -rf /tmp/* && \
rm -rf /var/tmp/*
RUN mkdir -p /opt/cdflow-commands/cdflow_commands && \
pip install pipenv
WORKDIR /opt/cdflow-commands/
ENV PYTHONPATH=/opt/cdflow-commands
COPY Pipfile Pipfile.lock ./
RUN apk add --no-cache --virtual .build-deps \
gcc musl-dev libffi-dev openssl-dev && \
pipenv install --deploy --system && \
apk del --no-cache .build-deps
FROM base AS test
ENV AWS_ACCESS_KEY_ID dummy
ENV AWS_SECRET_ACCESS_KEY dummy
COPY Pipfile Pipfile.lock ./
RUN apk add --no-cache --virtual .build-deps \
gcc musl-dev libffi-dev openssl-dev && \
pipenv install --deploy --system --dev && \
apk del --no-cache .build-deps
COPY ./cdflow_commands /opt/cdflow-commands/cdflow_commands/
COPY ./test /opt/cdflow-commands/test/
FROM base
COPY ./cdflow_commands /opt/cdflow-commands/cdflow_commands/
LABEL type="platform"
ENTRYPOINT ["python", "-m", "cdflow_commands"]