Skip to content

Commit d04aa82

Browse files
committed
Fix build
1 parent e879913 commit d04aa82

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Dockerfile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,28 @@ RUN ["python3", "-m", "venv", "/venv"]
1919
ENV PATH="/venv/bin:$PATH"
2020
RUN ["python3", "-m", "pip", "install", "-r", "requirements.txt"]
2121

22+
COPY src/main.py src/main.py
23+
COPY dump_openapi.py .
24+
ENV FASTAPI_OPENAPI_OUTPUT="/tmp/openapi.json"
25+
RUN ["mkdir", "-p", "frontend/dist"]
26+
RUN ["python3", "dump_openapi.py"]
27+
2228
FROM node:20 as build-frontend
2329

2430
# Path: /tmp/
2531
WORKDIR /tmp/
2632

27-
COPY ./frontend .
33+
COPY ./frontend frontend
34+
WORKDIR /tmp/frontend
2835
RUN ["npm", "install"]
36+
COPY --from=build-server /tmp/openapi.json /tmp/openapi.json
37+
RUN ["npx", "openapi-typescript", "/tmp/openapi.json", "-o", "src/api/schema.d.ts"]
2938
RUN ["npm", "run", "build"]
3039

3140
FROM python:3.12-slim as production
3241
COPY --from=build-server /venv /venv
3342
COPY src/main.py .
34-
COPY --from=build-frontend /tmp/dist ./frontend/dist
43+
COPY --from=build-frontend /tmp/frontend/dist ./frontend/dist
3544
ENV PATH="/venv/bin:$PATH"
3645

3746
ENTRYPOINT [ "python3", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--proxy-headers" ]

0 commit comments

Comments
 (0)