diff --git a/modules/request-module/docker-compose.yml b/modules/request-module/docker-compose.yml index ed01b94..2cc7090 100644 --- a/modules/request-module/docker-compose.yml +++ b/modules/request-module/docker-compose.yml @@ -1,10 +1,10 @@ -version: '3.8' +version: "3.8" services: app: build: . - ports: - - "8000:8000" + expose: + - "8000" environment: - DATABASE_URL=postgresql://user:password@db:5432/service_request - REDIS_URL=redis://redis:6379/0 @@ -20,7 +20,7 @@ services: - TWILIO_FROM_NUMBER=+15017250604 - APP_ENV=development - APP_DEBUG=True - - APP_CORS_ORIGINS=http://localhost:3000,http://localhost:5173 + - APP_CORS_ORIGINS=http://192.168.1.36 - MANAGEENGINE_CONNECTION_STRING= depends_on: - db @@ -31,6 +31,16 @@ services: - /app/.venv command: uvicorn request_app.main:app --host 0.0.0.0 --port 8000 + frontend: + build: + context: ./frontend + dockerfile: Dockerfile + ports: + - "80:80" + depends_on: + - app + restart: unless-stopped + db: image: postgres:15 environment: @@ -63,4 +73,4 @@ services: volumes: postgres_data: redis_data: - rabbitmq_data: + rabbitmq_data: \ No newline at end of file diff --git a/modules/request-module/frontend/Dockerfile b/modules/request-module/frontend/Dockerfile new file mode 100644 index 0000000..074696c --- /dev/null +++ b/modules/request-module/frontend/Dockerfile @@ -0,0 +1,19 @@ +FROM node:22-alpine AS build + +WORKDIR /app + +COPY package*.json ./ +RUN npm ci + +COPY . . +RUN npm run build + + +FROM nginx:alpine + +COPY --from=build /app/dist /usr/share/nginx/html +COPY nginx.conf /etc/nginx/conf.d/default.conf + +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/modules/request-module/frontend/nginx.conf b/modules/request-module/frontend/nginx.conf new file mode 100644 index 0000000..9060568 --- /dev/null +++ b/modules/request-module/frontend/nginx.conf @@ -0,0 +1,21 @@ +server { + listen 80; + server_name _; + + root /usr/share/nginx/html; + index index.html; + + location /api/ { + proxy_pass http://app:8000/api/; + proxy_http_version 1.1; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + location / { + try_files $uri $uri/ /index.html; + } +} \ No newline at end of file