refactor: Update Docker configurations for improved environment variable handling
Some checks failed
Deploy to Production, build images and push to Gitea Registry / build_and_push (pull_request) Failing after 22s
Some checks failed
Deploy to Production, build images and push to Gitea Registry / build_and_push (pull_request) Failing after 22s
- Changed the frontend Dockerfile to use process.env for environment variables instead of direct interpolation. - Updated the production Docker Compose file to set environment variables directly instead of using build args. - Switched the backend Dockerfile base image from `python:3.11-slim` to `python:alpine` for a smaller image size and increased worker count from 4 to 8 for better performance.
This commit is contained in:
parent
99d6c5ffaa
commit
a51b18e8f5
@ -1,5 +1,5 @@
|
|||||||
# Multi-stage build for production
|
# Multi-stage build for production
|
||||||
FROM python:3.11-slim as base
|
FROM python:alpine as base
|
||||||
|
|
||||||
# Set environment variables
|
# Set environment variables
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||||
@ -58,7 +58,6 @@ EXPOSE 8000
|
|||||||
CMD ["uvicorn", "app.main:app", \
|
CMD ["uvicorn", "app.main:app", \
|
||||||
"--host", "0.0.0.0", \
|
"--host", "0.0.0.0", \
|
||||||
"--port", "8000", \
|
"--port", "8000", \
|
||||||
"--workers", "4", \
|
"--workers", "8", \
|
||||||
"--worker-class", "uvicorn.workers.UvicornWorker", \
|
|
||||||
"--access-log", \
|
"--access-log", \
|
||||||
"--log-level", "info"]
|
"--log-level", "info"]
|
@ -66,7 +66,7 @@ services:
|
|||||||
context: ./fe
|
context: ./fe
|
||||||
dockerfile: Dockerfile.prod
|
dockerfile: Dockerfile.prod
|
||||||
target: production
|
target: production
|
||||||
args:
|
environment:
|
||||||
- VITE_API_URL=${VITE_API_URL}
|
- VITE_API_URL=${VITE_API_URL}
|
||||||
- VITE_SENTRY_DSN=${VITE_SENTRY_DSN}
|
- VITE_SENTRY_DSN=${VITE_SENTRY_DSN}
|
||||||
ports:
|
ports:
|
||||||
|
@ -53,9 +53,9 @@ RUN echo '{ \n "rewrites": [ \n { "source": "**", "destination": "/index.htm
|
|||||||
RUN echo '#!/bin/sh\n\
|
RUN echo '#!/bin/sh\n\
|
||||||
cat > /app/env-config.js << EOL\n\
|
cat > /app/env-config.js << EOL\n\
|
||||||
window.ENV = {\n\
|
window.ENV = {\n\
|
||||||
VITE_API_URL: "${VITE_API_URL}",\n\
|
VITE_API_URL: process.env.VITE_API_URL,\n\
|
||||||
VITE_SENTRY_DSN: "${VITE_SENTRY_DSN}",\n\
|
VITE_SENTRY_DSN: process.env.VITE_SENTRY_DSN,\n\
|
||||||
VITE_ROUTER_MODE: "${VITE_ROUTER_MODE}"\n\
|
VITE_ROUTER_MODE: process.env.VITE_ROUTER_MODE\n\
|
||||||
};\n\
|
};\n\
|
||||||
EOL\n\
|
EOL\n\
|
||||||
serve -s . -l 3000' > /app/start.sh && chmod +x /app/start.sh
|
serve -s . -l 3000' > /app/start.sh && chmod +x /app/start.sh
|
||||||
|
Loading…
Reference in New Issue
Block a user