-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
47 lines (40 loc) · 1.23 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
FROM python:3.11.5-slim-bookworm
ENV PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONHASHSEED=random \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
CUSTOM_DEBUG_FLAG=False \
# Poetry's configuration:
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_CREATE=false \
POETRY_CACHE_DIR='/var/cache/pypoetry' \
POETRY_HOME='/usr/local' \
POETRY_VERSION=1.8.3
# Install system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
libpq-dev \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install Poetry
RUN curl -sSL https://install.python-poetry.org | python3 -
ENV PATH="${PATH}:/root/.poetry/bin"
WORKDIR /app
COPY pyproject.toml .
COPY poetry.lock .
RUN poetry install --no-root --only main --no-interaction
RUN poetry show --tree
COPY . .
RUN rm -rf .venv
# Database
ENV USE_POSTGRES=False
ENV CUSTOM_DEBUG_FLAG=True
RUN python manage.py migrate --no-input
# Collect static files for admin pages
RUN python manage.py collectstatic --noinput --clear
EXPOSE 8000
CMD ["poetry", "run", "gunicorn", "--config", "gunicorn_config.py", "--bind", "0.0.0.0:8000", "sas_backend.wsgi:application"]