-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
48 lines (36 loc) · 1.12 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
FROM python:3.11-alpine
LABEL org.opencontainers.image.source = "https://github.com/RomanMazyrin/Salaries-project"
# Create separate user
RUN addgroup --system app && adduser -S -G app app
USER app
WORKDIR /home/app
ENV \
# Adding folder with poetry to PATH so poetry can be called
PATH="/home/app/.local/bin:$PATH" \
# Python
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
# Poetry
POETRY_VERSION="1.6.1" \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR="/tmp/poetry_cache" \
# Gunicorn
G_PORT=8000 \
G_NUM_OF_WORKERS=2 \
G_WORKER_TIMEOUT=60 \
G_WORKER_CONNECTIONS=1000
# Install poetry
COPY --chown=app:app install_poetry.py .
RUN python install_poetry.py
# Install application python dependencies
COPY --chown=app:app pyproject.toml poetry.lock ./
RUN poetry install && rm -rf $POETRY_CACHE_DIR
# Copy entrypoint script
COPY --chown=app:app entrypoint.sh .
# Copy project files
COPY --chown=app:app . .
# Collect static
RUN poetry run python manage.py collectstatic --no-input
CMD [ "./entrypoint.sh" ]