-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
62 lines (48 loc) · 1.54 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
#######################################
# Stage 1
FROM alpine:3.16.2 as build
COPY build/sources.list /etc/apk/repositories
RUN apk add --update --no-cache \
gcc \
curl \
musl-dev \
python3-dev \
libffi-dev \
openssl-dev \
py3-pip
COPY build/pip.conf /etc/pip.conf
COPY build/constraint.txt /build/constraint.txt
COPY build/requirements.txt /build/requirements.txt
RUN test -d /module/venv || python3 -m venv /module/venv
RUN source /module/venv/bin/activate && pip install --no-cache-dir -r /build/requirements.txt
RUN curl --retry 3 --retry-connrefused --retry-delay 5 -LO https://github.com/mozilla/sops/releases/download/v3.9.0/sops-v3.9.0.linux.amd64 && \
chmod +x sops-v3.9.0.linux.amd64 && \
mv sops-v3.9.0.linux.amd64 /usr/local/bin/sops
#######################################
# Stage 2
FROM alpine:3.16.2
COPY build/pip.conf /etc/pip.conf
COPY build/constraint.txt /build/constraint.txt
COPY build/sources.list /etc/apk/repositories
RUN apk add --no-cache \
python3-dev \
bash \
ca-certificates \
tar \
curl \
jq \
yq \
gettext \
sed \
age
COPY --from=build /module /module
COPY --from=build /usr/local/bin/sops /usr/local/bin/sops
COPY scripts /module/scripts
RUN addgroup ci && adduser -D -h /module/ -s /bin/bash -G ci ci && \
chown ci:ci -R /module && \
chmod 754 /module/scripts/* && \
chmod +x /usr/local/bin/sops
ENV PATH=/module/venv/bin:$PATH
USER ci:ci
WORKDIR /module/scripts
#ENTRYPOINT ["/bin/bash", "-c"] # https://github.com/moby/moby/issues/3753