-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
46 lines (36 loc) · 1.09 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
FROM python:3.11-alpine3.20
LABEL maintainer="[email protected]"
LABEL version="###VERSION###"
# Elevate privilege level.
USER root
# Update any OS packages.
RUN apk update --no-cache
# Update pip
RUN pip3 install --upgrade --no-cache-dir pip wheel
# Add normal user
RUN addgroup -g 998 -S appgroup && \
adduser --uid 1000 -S appuser -G appgroup
# Copy our files.
WORKDIR /app
COPY --chown=appuser:appgroup dumper.py /app/dumper.py
COPY --chown=appuser:appgroup distrodumper /app/distrodumper
COPY --chown=appuser:appgroup requirements.txt /app/requirements.txt
# Prepare cache and dump mountpoints.
RUN mkdir -p /dump /cache
RUN chown appuser:appgroup /cache
RUN chown appuser:appgroup /dump
# Drop to normal user.
USER appuser
# Install pip packages.
ENV PATH="/home/appuser/.local/bin:${PATH}"
RUN pip3 install \
--user \
--ignore-installed \
--no-cache-dir \
-r requirements.txt
# Return to normal user, set configuration environment variables and run app.
USER appuser
ENV DUMP_INTERVAL=3600
ENV DUMP_DIRECTORY="/cache"
ENV CACHE_DIRECTORY="/dump"
ENTRYPOINT ["python3", "dumper.py"]