-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (28 loc) · 1.07 KB
/
Dockerfile
File metadata and controls
43 lines (28 loc) · 1.07 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
FROM python:3.10-slim as base_image
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
POETRY_VERSION=1.3.1
WORKDIR /tmp
RUN pip install "poetry==$POETRY_VERSION"
COPY ./poetry.lock ./pyproject.toml ./
RUN poetry export --with dep --without dev,test -f requirements.txt -o requirements.dep.txt && \
poetry export --with dev --without dep,test -f requirements.txt -o requirements.dev.txt && \
rm poetry.lock pyproject.toml && \
pip uninstall poetry -y
WORKDIR /server
# Копирование файлов проекта
COPY todolist/manage.py .
COPY todolist/entrypoint.sh .
COPY todolist/bot bot
COPY todolist/core core
COPY todolist/goals goals
COPY todolist/todolist todolist
EXPOSE 8000
# Применение миграций
ENTRYPOINT ["bash", "entrypoint.sh"]
FROM base_image as dep_image
RUN pip install -r /tmp/requirements.dep.txt
CMD ["gunicorn", "todolist.wsgi:application", "-w", "4", "--bind", "0.0.0.0:8000"]
FROM base_image as dev_image
RUN pip install -r /tmp/requirements.dev.txt
CMD ["python3", "manage.py", "runserver", "0.0.0.0:8000"]