-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile.web-demo
42 lines (26 loc) · 1.07 KB
/
Dockerfile.web-demo
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
FROM node:alpine as build-client
WORKDIR /build
COPY web-demo/client /build
RUN npm install && npm run build
# --------------------
# DO NOT use python 3.12, it could cause dependency problems
# DO NOT use `python:alpine` as the base image for python projects
# It could causes problems while installing packages and have a much longer building time
FROM python:3.11.6-slim-bookworm as build-webapp
WORKDIR /build
COPY pyproject.toml README.md ./
COPY yomigana_ebook ./yomigana_ebook
COPY web-demo/pyproject.toml web-demo/README.md ./web-demo/
COPY web-demo/web_demo ./web-demo/web_demo
WORKDIR /build/web-demo
RUN pip install .
RUN python -m unidic download
# --------------------
FROM python:3.11.6-slim-bookworm as production
WORKDIR /app
COPY --from=build-client /build/dist ./client/dist
COPY --from=build-webapp /usr/local/bin /usr/local/bin
COPY --from=build-webapp /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
COPY web-demo/pyproject.toml web-demo/README.md ./
COPY web-demo/web_demo ./web_demo
ENTRYPOINT ["uvicorn", "web_demo.main:app"]