-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (29 loc) · 1.2 KB
/
Copy pathDockerfile
File metadata and controls
36 lines (29 loc) · 1.2 KB
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
FROM python:3.14-slim-trixie
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
WORKDIR /app
RUN apt update && \
apt upgrade -y && \
apt install -y aria2 build-essential libxml2-dev libxslt1-dev python3-dev zlib1g-dev && \
apt purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false && \
apt clean && \
rm -rf /var/lib/apt/lists/*
RUN addgroup --gid ${GID:-1000} python && \
adduser --disabled-password --gecos "" --home /app --uid ${UID:-1000} --gid ${GID:-1000} python && \
chown -R python:python /app
COPY requirements.txt /app/
RUN --mount=type=cache,target=/var/cache/pip \
pip install --cache-dir /var/cache/pip -U pip && \
pip install --cache-dir /var/cache/pip -Ur /app/requirements.txt
ARG ENV_TYPE=production
ENV ENV_TYPE=${ENV_TYPE}
COPY requirements-development.txt /app/
RUN --mount=type=cache,target=/car/cache/pip \
if [ "$(echo $ENV_TYPE | tr A-Z a-z)" != "production" ]; then \
pip install --cache-dir /var/cache/pip -Ur /app/requirements-development.txt; \
apt update && apt install -y git make && apt clean && rm -rf /var/lib/apt/lists/*; \
else \
rm /app/requirements-development.txt ; \
fi
COPY --chown=python:python . /app/
USER python