-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (38 loc) · 1.17 KB
/
Copy pathDockerfile
File metadata and controls
50 lines (38 loc) · 1.17 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
ARG FRONTEND_ENV=docker
FROM python:3.12-slim AS api-build
RUN apt-get update && apt-get install -y \
build-essential \
curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app/api
COPY api/poetry.lock api/pyproject.toml ./
RUN pip install poetry
RUN poetry config virtualenvs.create false
RUN poetry install --without dev --no-cache --no-root
COPY api/ ./
FROM node:20-alpine AS frontend-build
ARG FRONTEND_ENV
WORKDIR /app/front
COPY front/package*.json ./
COPY front/yarn.lock ./
RUN yarn install --frozen-lockfile
COPY front/ ./
COPY front/.env.${FRONTEND_ENV} .env
RUN yarn build
FROM python:3.12-slim AS production
RUN apt-get update && apt-get install -y \
nginx \
curl \
gettext-base \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=api-build /usr/local /usr/local
COPY --from=api-build /app/api /app/api
COPY --from=frontend-build /app/front/dist /usr/share/nginx/html
COPY infra/nginx/nginx.conf.template /etc/nginx/nginx.conf.template
COPY startup.sh /startup.sh
RUN chmod +x /startup.sh
EXPOSE 7777
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:7777/health || exit 1
CMD ["/startup.sh"]