-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
27 lines (19 loc) · 1012 Bytes
/
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
FROM python:3.10.2
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
RUN apt-get update -y && apt-get install -y --no-install-recommends libsqlite3-dev && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN python3 -m pip install -U pip && python3 -m pip install --no-cache-dir poetry gunicorn
WORKDIR /app
COPY order_app /app/order_app
COPY *.toml /app/
COPY poetry.lock /app
ENV PYTHONPATH /app
ENV DJANGO_SETTINGS_MODULE order_app.infrastructure.order_mgmt.settings
RUN export PYTHONPATH=$PYTHONPATH:/app/order_app
RUN poetry install
# make migrations
RUN DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE poetry run python -m order_app.infrastructure.manage makemigrations
RUN DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE poetry run python -m order_app.infrastructure.manage migrate
# collect static files
RUN DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE poetry run python -m order_app.infrastructure.manage collectstatic
CMD poetry run gunicorn order_app.infrastructure.order_mgmt.wsgi:application