-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
59 lines (46 loc) · 1.51 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
FROM docker.io/python:3.10-alpine AS base
#################### update ####################
FROM base AS update
# Obtain any recent security updates not in image
RUN set -eux; \
apk update; \
apk upgrade --verbose
#################### /update ####################
#################### builder ####################
FROM update AS builder
RUN set -eux; \
# Install gcc and libraries needed for building regex during pip install step
apk add --no-cache \
gcc=~10.3 \
musl-dev=~1.2; \
# Install copier
pip install --no-cache-dir copier==5.1.0; \
apk del \
gcc \
musl-dev
#################### /builder ####################
#################### final ####################
FROM update AS final
ARG COPIER_DEST_PATH
ENV COPIER_DEST_PATH=${COPIER_DEST_PATH:-/usr/src/copier}
WORKDIR "$COPIER_DEST_PATH"
# Add non-root user to run copier
RUN set -eux; \
adduser -D user; \
chown -R user:user "$COPIER_DEST_PATH"
RUN set -eux; \
apk add --no-cache \
# Install git, dependency of copier
git=~2.32 \
# Install su-exec to drop down from root when running copier
su-exec=0.2-r1
# Copy over python packages and copier script from builder
COPY --from=builder /usr/local/lib/python3.10 /usr/local/lib/python3.10
COPY --from=builder /usr/local/bin/copier /usr/local/bin/copier
COPY ./docker-entrypoint.sh /docker-entrypoint.sh
RUN set -eux; \
chmod 0755 /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["copier","--version"]
# CMD ["bash"]
#################### /final ####################