From 041f7c1ac9dc25f5498aefde1f45d3010d11257a Mon Sep 17 00:00:00 2001 From: BluemediaDev Date: Sun, 27 Jul 2025 19:38:40 +0000 Subject: [PATCH] Include frontend in container --- Dockerfile | 13 +++++++++++++ backend/app/main.py | 13 ------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 27e0ad9..fdb93e1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,11 @@ +# Build frontend +FROM node:22-alpine AS frontend-builder + +COPY frontend /usr/src/frontend +WORKDIR /usr/src/frontend +RUN npm ci +RUN npm run build + # `python-base` sets up all our shared environment variables FROM python:3.13-slim AS python-base @@ -52,11 +60,16 @@ RUN poetry install # `production` image used for runtime FROM python-base AS production + ENV FASTAPI_ENV=production + COPY --from=builder-base $PYSETUP_PATH $PYSETUP_PATH COPY backend/alembic.ini /usr/src/ COPY start.sh /usr/src/ COPY backend/alembic /usr/src/alembic COPY backend/app /usr/src/app + +COPY --from=frontend-builder /usr/src/frontend/build /usr/src/static + WORKDIR /usr/src CMD ["bash", "start.sh"] \ No newline at end of file diff --git a/backend/app/main.py b/backend/app/main.py index c3bf377..8dba7a4 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -76,19 +76,6 @@ def create_app(): static_files = StaticFiles(directory="static", html=True) root_app.mount(path="/", app=static_files) - origins = [ - "http://localhost", - "http://localhost:5173", - ] - - root_app.add_middleware( - CORSMiddleware, - allow_origins=origins, - allow_credentials=True, - allow_methods=["*"], - allow_headers=["*"], - ) - return root_app app = create_app()