-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
65 lines (45 loc) · 1.87 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
63
64
65
FROM python:3.13.1-alpine@sha256:657dbdb20479a6523b46c06114c8fec7db448232f956a429d3cc0606d30c1b59
# Prevent Python from writing out pyc files
ENV PYTHONDONTWRITEBYTECODE 1
# Keep Python from buffering stdin/stdout
ENV PYTHONUNBUFFERED 1
ARG KOMETA_VERSION
# Enable custom virtual environment
ENV VIRTUAL_ENV=/opt/venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Install system packages
RUN apk add --no-cache libxml2-dev libxslt-dev jpeg-dev tzdata gcc g++ python3-dev zlib-dev linux-headers
WORKDIR /app
# Install Kometa and its dependencies
RUN apk add --no-cache git && \
git clone https://github.com/Kometa-Team/Kometa -b ${KOMETA_VERSION} && \
cd Kometa && \
python3 -m venv "${VIRTUAL_ENV}" && \
pip install --upgrade pip && \
pip install --no-cache-dir --upgrade --requirement requirements.txt
FROM python:3.13.1-alpine@sha256:657dbdb20479a6523b46c06114c8fec7db448232f956a429d3cc0606d30c1b59
# Prevent Python from writing out pyc files
ENV PYTHONDONTWRITEBYTECODE 1
# Keep Python from buffering stdin/stdout
ENV PYTHONUNBUFFERED 1
# Install system packages and create non-root user
RUN apk update && \
apk add --no-cache libxml2-dev libxslt-dev jpeg-dev && \
rm -rf /var/cache/apk/* /tmp/* && \
addgroup kometa && adduser -G kometa -h /app -D kometa
# Enable custom virtual environment
ENV VIRTUAL_ENV=/opt/venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Copy virtual environment from previous stage
COPY --from=0 --chown=kometa:kometa /opt/venv $VIRTUAL_ENV
# Set working directory
WORKDIR /app
# Copy required files
COPY --from=0 --chown=kometa:kometa /app/Kometa/config config
COPY --from=0 --chown=kometa:kometa /app/Kometa/modules modules
COPY --from=0 --chown=kometa:kometa /app/Kometa/kometa.py .
COPY --from=0 --chown=kometa:kometa /app/Kometa/VERSION VERSION
VOLUME /config
# Set non root user to run the application
USER kometa
ENTRYPOINT ["python3", "kometa.py"]