-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
48 lines (28 loc) · 967 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# npm
# use the same base image as the others for efficiency
FROM python:3.12.3-slim AS npm-packages
RUN apt-get update && apt-get install --yes nodejs npm > /dev/null
WORKDIR /src
COPY package.json .
RUN npm install
# poetry
FROM python:3.12.3-slim AS poetry-packages
RUN apt-get update && apt-get install --yes build-essential > /dev/null
RUN pip install poetry poetry-plugin-bundle
WORKDIR /src
COPY pyproject.toml .
COPY poetry.lock .
# do this so that poetry bundle can run without the project - can't pass --no-root to bundle
RUN touch README.md
RUN poetry bundle venv ./venv
# app
FROM python:3.12.3-slim
RUN apt-get update && apt-get install --yes libpq-dev > /dev/null
WORKDIR /usr/src/app
COPY --from=npm-packages /src/node_modules ./node_modules
COPY --from=poetry-packages /src/venv ./venv
COPY . .
ENV DJANGO_SETTINGS_MODULE='consultation_analyser.settings.production'
ENV PYTHONPATH "${PYTHONPATH}:/."
EXPOSE 8000
CMD ["./start.sh"]