-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (30 loc) · 870 Bytes
/
Dockerfile
File metadata and controls
41 lines (30 loc) · 870 Bytes
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
FROM python:3.10.13 AS base
# Configure volume/workdir
RUN mkdir /code
WORKDIR /code/
COPY pyproject.toml /code/
COPY poetry.lock /code/
FROM base as deps
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED TRUE
ENV PYTHONPATH=/code/:/usr/lib/python3.10.2/site-packages
# Configure volume/workdir
WORKDIR /code/
# Install poetry
RUN pip install --upgrade pip
RUN pip install --no-cache-dir poetry
# Add and install requirements
RUN poetry config virtualenvs.create false && poetry install --only main --no-interaction --no-ansi
FROM deps
WORKDIR /code/
COPY . /code/
RUN mkdir static
RUN SECRET_KEY=build_random_secret python manage.py collectstatic
# Create a user with UID 1000 and GID 1000
RUN groupadd -g 1000 appgroup && \
useradd -r -u 1000 -g appgroup appuser
# Switch to this user
USER 1000:1000
# copy project
COPY . .