forked from pyladies/pyladiescon-portal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
50 lines (36 loc) · 1.38 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
FROM python:3.13-bookworm AS base
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
RUN mkdir /code
WORKDIR /code
RUN pip --no-cache-dir --disable-pip-version-check install --upgrade pip setuptools wheel
COPY requirements.txt /code/
RUN --mount=type=cache,target=/root/.cache/pip \
pip install -r requirements.txt
###############################################################################
# Build our development container
###############################################################################
FROM base AS dev
ARG USER_ID
ARG GROUP_ID
RUN groupadd -o -g $GROUP_ID -r usergrp
RUN useradd -o -m -u $USER_ID -g $GROUP_ID user
RUN chown user /code
COPY requirements-dev.txt /code/
RUN --mount=type=cache,target=/root/.cache/pip \
pip install -r requirements-dev.txt
RUN chown -R user /usr/local/lib/python3.13/site-packages
USER user
ENV PATH="${PATH}:/home/user/.local/bin"
###############################################################################
# Build our production container
###############################################################################
FROM base
RUN chown -R nobody /usr/local/lib/python3.13/site-packages
COPY . /code/
RUN \
DJANGO_ALLOWED_HOSTS=localhost \
DJANGO_SECRET_KEY=deadbeefcafe \
DATABASE_URL=postgres://localhost:5432/db \
DJANGO_SETTINGS_MODULE=portal.settings \
python manage.py collectstatic --noinput