diff --git a/docker-compose.yaml b/docker-compose.yaml index 849de395..18eb507f 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -10,6 +10,7 @@ services: - .env environment: - APP_ENV=${APP_ENV:-development} + - GO_ENV=${APP_ENV:-development} - COOKIE_SECRET=${COOKIE_SECRET} - JWT_SECRET=${JWT_SECRET} - DESCOPE_PROJECT_ID=${DESCOPE_PROJECT_ID} @@ -39,14 +40,27 @@ services: context: ./frontend dockerfile: Dockerfile container_name: baron_frontend + env_file: + - .env environment: - DESCOPE_PROJECT_ID=${DESCOPE_PROJECT_ID} + - BACKEND_URL=${BACKEND_URL} + - FRONTEND_URL=${FRONTEND_URL} + - APP_ENV=${APP_ENV} ports: - "${FRONTEND_PORT:-5000}:5000" networks: - baron_net depends_on: - backend + command: > + /bin/sh -c "mkdir -p /usr/share/nginx/html/assets && + echo \"DESCOPE_PROJECT_ID=$${DESCOPE_PROJECT_ID}\" > /usr/share/nginx/html/assets/.env && + echo \"BACKEND_URL=$${BACKEND_URL}\" >> /usr/share/nginx/html/assets/.env && + echo \"FRONTEND_URL=$${FRONTEND_URL}\" >> /usr/share/nginx/html/assets/.env && + echo \"APP_ENV=$${APP_ENV}\" >> /usr/share/nginx/html/assets/.env && + cp /usr/share/nginx/html/assets/.env /usr/share/nginx/html/.env && + nginx -g 'daemon off;'" # Dummy service to wait for infra network if needed, # but essentially we assume infra is running. diff --git a/frontend/.env.sample b/frontend/.env.sample deleted file mode 100644 index 1a40fcee..00000000 --- a/frontend/.env.sample +++ /dev/null @@ -1,34 +0,0 @@ -# ========================================== -# Baron SSO - Unified Environment Configuration -# ========================================== - -# --- General System --- -APP_ENV=development -TZ=Asia/Seoul - -# --- Infrastructure Ports --- -DB_PORT=5432 -CLICKHOUSE_PORT_HTTP=8123 -CLICKHOUSE_PORT_NATIVE=9000 -BACKEND_PORT=3000 -FRONTEND_PORT=5000 - -# --- Database Credentials (PostgreSQL) --- -DB_USER=baron -DB_PASSWORD=password -DB_NAME=baron_sso - -# --- Backend Configuration --- -# Must be 32 bytes. Generate with `openssl rand -hex 32` -COOKIE_SECRET=super-secret-key-must-be-32-bytes! -REDIS_ADDR=redis:6379 - -# --- Frontend Configuration --- -# Descope Project ID (Required for Auth) -DESCOPE_PROJECT_ID=P2t...your_descope_project_id - -# --- Naver Cloud Services --- -NAVER_CLOUD_ACCESS_KEY=ncp_iam_... -NAVER_CLOUD_SECRET_KEY=ncp_iam_... -NAVER_CLOUD_SERVICE_ID=ncp:sms:kr:...:... -NAVER_SENDER_PHONE_NUMBER=... diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 5b420d61..0483df6f 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -4,6 +4,7 @@ WORKDIR /app COPY . . # Get dependencies and build for web RUN flutter pub get +RUN touch .env RUN flutter build web --release # Stage 2: Serve with Nginx