-
-
Notifications
You must be signed in to change notification settings - Fork 143
/
Dockerfile
37 lines (32 loc) · 1.26 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
# Django build (main image)
FROM python:3.11-bullseye
ENV PYTHONUNBUFFERED 1
ARG DEV_BUILD
WORKDIR /app
RUN echo "deb http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& python -c 'from urllib.request import urlopen; print(urlopen("https://www.postgresql.org/media/keys/ACCC4CF8.asc").read().decode())' > /etc/apt/trusted.gpg.d/postgres.asc \
&& apt update \
&& apt upgrade -y \
&& apt install -y \
build-essential \
gettext \
libpq-dev \
libz-dev \
make \
postgresql-client-14 \
python3-dev \
wget \
&& apt purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& apt clean \
&& rm -rf /var/lib/apt/lists/*
RUN pip install --no-cache-dir -U pip
RUN addgroup --gid ${GID:-1000} django \
&& adduser --gid ${GID:-1000} --uid ${UID:-1000} --home=/app django \
&& chown -R django:django /app
ADD srv/nginx.conf.sigil /app/
COPY requirements.txt requirements-development.txt /app/
RUN pip install --no-cache-dir -Ur /app/requirements.txt
RUN if [ "$DEV_BUILD" = "true" ]; then pip install --no-cache-dir -Ur /app/requirements-development.txt; fi
COPY . /app/
RUN chown -R django:django /app
USER django