-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (32 loc) · 1.46 KB
/
Copy pathDockerfile
File metadata and controls
44 lines (32 loc) · 1.46 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
37
38
39
40
41
42
43
44
FROM python:3.14.2-slim
LABEL maintainer="Edward K"
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
COPY ./requirements.txt /tmp/requirements.txt
COPY ./scripts /scripts
COPY ./app /app
WORKDIR /app
EXPOSE 8000
ARG DEV=false
RUN python -m venv /py && \
/py/bin/pip install --upgrade pip && \
apt-get update && \
apt-get install -y --no-install-recommends ca-certificates curl gnupg libjpeg-dev \
zlib1g-dev build-essential libpq-dev && \
install -d /usr/share/postgresql-common/pgdg && \
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.gpg && \
. /etc/os-release && \
echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.gpg] https://apt.postgresql.org/pub/repos/apt ${VERSION_CODENAME}-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
apt-get update && \
apt-get install -y --no-install-recommends postgresql-client-18 && \
/py/bin/pip install -r /tmp/requirements.txt && \
rm -rf /var/lib/apt/lists/* /tmp/* && \
apt-get purge -y --auto-remove build-essential libpq-dev gnupg && \
adduser --disabled-password --no-create-home django-user && \
mkdir -p /vol/web/media /vol/web/static && \
chown -R django-user:django-user /vol && \
chmod -R 755 /vol /app && \
chmod -R +x /scripts
ENV PATH="/scripts:/py/bin:$PATH"
# Removed USER django-user to run management commands as root
CMD ["run.sh"]