-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
48 lines (36 loc) · 1.02 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
ARG DOCKER_IMAGE=python:3.9-alpine \
USER=coolio \
GROUP=coolio \
UID=1234 \
GID=4321
# Install image
FROM $DOCKER_IMAGE AS install-image
WORKDIR /app
COPY . .
RUN apk add --no-cache tzdata git \
&& pip install --no-cache-dir --upgrade pip \
&& pip install --user --no-cache-dir .
# Runtime image
FROM $DOCKER_IMAGE AS runtime-image
ARG USER \
GROUP \
UID \
GID
ENV PATH="/home/.local/bin:$PATH" \
XDG_CONFIG_HOME=/config \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
RUN mkdir -p /home $XDG_CONFIG_HOME \
&& addgroup --gid $GID $GROUP \
&& adduser -D -H --gecos "" \
--home "/home" \
--ingroup "$GROUP" \
--uid "$UID" \
"$USER" \
&& chown -R $USER:$GROUP /home $XDG_CONFIG_HOME \
&& rm -rf /tmp/* /var/{cache,log}/* /var/lib/apt/lists/*
USER $USER
WORKDIR /home
COPY --from=install-image --chown=$USER:$GROUP /root/.local /home/.local
VOLUME /config
ENTRYPOINT ["firefly-cli"]