-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
77 lines (56 loc) · 1.9 KB
/
Dockerfile
File metadata and controls
77 lines (56 loc) · 1.9 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
FROM node:22 AS frontend-builder
COPY frontend /frontend
WORKDIR /frontend
RUN yarn install --frozen-lockfile && yarn build
FROM python:3.11-alpine AS backend-builder
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
POETRY_VERSION=1.8.3 \
POETRY_HOME="/opt/poetry" \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_VIRTUALENVS_CREATE=true
RUN apk add --no-cache \
gcc \
musl-dev \
libffi-dev \
openssl-dev \
python3-dev \
linux-headers \
curl \
make
RUN curl -sSL https://install.python-poetry.org | python3 -
ENV PATH="$POETRY_HOME/bin:$PATH"
WORKDIR /app
COPY backend/pyproject.toml backend/poetry.lock* ./
RUN poetry install --only main --no-root --no-directory
COPY backend/ ./
RUN poetry install --only main
FROM nginx:1.27-alpine AS runtime
RUN apk add --no-cache \
libffi \
openssl \
libgcc \
libstdc++ \
sqlite-libs
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
VIRTUAL_ENV=/app/.venv \
PATH="/usr/local/bin:/app/.venv/bin:$PATH" \
LD_LIBRARY_PATH="/usr/local/lib"
COPY --from=backend-builder /usr/local/bin/python3.11 /usr/local/bin/python3.11
COPY --from=backend-builder /usr/local/bin/python3 /usr/local/bin/python3
COPY --from=backend-builder /usr/local/lib/python3.11 /usr/local/lib/python3.11
COPY --from=backend-builder /usr/local/lib/libpython3.11.so.1.0 /usr/local/lib/libpython3.11.so.1.0
COPY --from=backend-builder /usr/local/lib/libpython3.so /usr/local/lib/libpython3.so
COPY --from=backend-builder /app/.venv /app/.venv
COPY --from=backend-builder /app /usr/share/nginx/backend
COPY --from=frontend-builder /frontend/dist /var/www/html/frontend
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY services.sh /services.sh
RUN chmod +x /services.sh
WORKDIR /usr/share/nginx/backend/
EXPOSE 5000
CMD ["/services.sh"]