fix: do proper backend docker build

This commit is contained in:
2025-07-24 16:59:31 +00:00
parent 3eb1522525
commit 830a9280b4
3 changed files with 16 additions and 11 deletions

View File

@@ -7,4 +7,6 @@ RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
ENV PYTHONPATH=/app
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "8000"]

View File

@@ -1,8 +1,13 @@
FROM node:20-alpine AS builder
FROM node:22-alpine AS builder
WORKDIR /app
COPY . .
RUN npm install && npm run build
FROM nginx:alpine
# Optional: use custom nginx config for React Router support
# COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/build /usr/share/nginx/html

View File

@@ -18,7 +18,7 @@ while True:
db_user = "minxa"
db_password = secrets.token_urlsafe(16)
db_name = "minxadb"
db_host = "minxa-db"
db_host = "db"
db_port = 5432
hashids_salt = secrets.token_urlsafe(32)
@@ -53,10 +53,8 @@ frontend_env_path.write_text(frontend_env)
print(f"✅ frontend/.env written")
# === Generate docker-compose.generated.yml === #
compose_yml = f"""version: "3.9"
services:
minxa-db:
compose_yml = f"""services:
db:
image: postgres:16
environment:
POSTGRES_USER: {db_user}
@@ -72,26 +70,26 @@ services:
networks:
- appnet
minxa-backend:
backend:
build:
context: ./backend
env_file:
- ./backend/.env
depends_on:
minxa-db:
db:
condition: service_healthy
ports:
- "8000:8000"
networks:
- appnet
minxa-frontend:
frontend:
build:
context: ./frontend
env_file:
- ./frontend/.env
depends_on:
- minxa-backend
- backend
ports:
- "3000:80"
networks: