-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (26 loc) · 1.14 KB
/
Dockerfile
File metadata and controls
31 lines (26 loc) · 1.14 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
FROM python:3.11-slim-bookworm
ENV PYTHONUNBUFFERED=1
ARG DEV_BUILD
WORKDIR /app
VOLUME /data
RUN apt update \
&& apt install -y build-essential gettext gnupg make python3-dev wget \
&& echo "deb http://apt.postgresql.org/pub/repos/apt bookworm-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& wget --quiet -O /etc/apt/trusted.gpg.d/postgres.asc https://www.postgresql.org/media/keys/ACCC4CF8.asc \
&& apt update \
&& apt install -y postgresql-client-16 libpq-dev \
&& apt upgrade -y \
&& apt purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& apt clean \
&& rm -rf /var/lib/apt/lists/*
RUN addgroup --gid ${GID:-1000} django \
&& adduser --disabled-password --gecos "" --home /app --uid ${UID:-1000} --gid ${GID:-1000} django \
&& chown -R django:django /app
COPY requirements.txt /app/
COPY requirements-development.txt /app/
RUN pip install --no-cache-dir -U pip \
&& pip install --no-cache-dir -Ur /app/requirements.txt \
&& if [ "$(echo $DEV_BUILD | tr A-Z a-z)" = "true" ]; then pip install --no-cache-dir -Ur /app/requirements-development.txt; fi
COPY . /app/
RUN chown -R django:django /app
USER django