dev, prod, local environment fixes
This commit is contained in:
+60
-2
@@ -16,6 +16,8 @@ services:
|
||||
- DB_HOST=psql #rewrite DB_HOST var to communicate inside the docker network
|
||||
- RABBITMQ_HOST=rabbitmq
|
||||
- REDIS_HOST=redis
|
||||
- FRONT_HOST=${FRONT_HOST}
|
||||
- FRONT_PORT=${FRONT_PORT}
|
||||
volumes:
|
||||
- type: bind
|
||||
source: ../src
|
||||
@@ -48,7 +50,7 @@ services:
|
||||
rabbitmq:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- "80:8000"
|
||||
- "${BACKEND_PORT}:8000"
|
||||
entrypoint: ["./entrypoint.sh", "--dev"]
|
||||
|
||||
backend-prod:
|
||||
@@ -65,6 +67,8 @@ services:
|
||||
- DB_HOST=psql
|
||||
- RABBITMQ_HOST=rabbitmq
|
||||
- REDIS_HOST=redis
|
||||
- FRONT_HOST=${FRONT_HOST}
|
||||
- FRONT_PORT=${FRONT_PORT}
|
||||
volumes:
|
||||
- type: bind
|
||||
source: ../configs
|
||||
@@ -89,7 +93,7 @@ services:
|
||||
rabbitmq:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- "80:8000"
|
||||
- "${BACKEND_PORT}:8000"
|
||||
|
||||
daemons:
|
||||
profiles: ["prod", "dev"]
|
||||
@@ -185,6 +189,60 @@ services:
|
||||
networks:
|
||||
- backend
|
||||
|
||||
nginx-dev:
|
||||
image: "${DOCKER_REGISTRY:-local}/excel-frontend-dev:${IMAGE_TAG:-local}"
|
||||
container_name: frontend-dev
|
||||
profiles: ["dev"]
|
||||
build:
|
||||
dockerfile: ./docker/dockerfile
|
||||
context: ../
|
||||
target: frontend_dev
|
||||
init: true
|
||||
ipc: private
|
||||
volumes:
|
||||
- type: bind
|
||||
source: ../frontend/src
|
||||
target: /home/excel-project/src
|
||||
- type: bind
|
||||
source: ../frontend/public
|
||||
target: /home/excel-project/public
|
||||
- type: bind
|
||||
source: ../frontend/index.html
|
||||
target: /home/excel-project/index.html
|
||||
- type: bind
|
||||
source: ../frontend/vite.config.ts
|
||||
target: /home/excel-project/vite.config.ts
|
||||
- type: bind
|
||||
source: ../frontend/configs
|
||||
target: /home/excel-project/configs
|
||||
ports:
|
||||
- "${FRONT_PORT}:5173"
|
||||
networks:
|
||||
- backend
|
||||
restart: always
|
||||
entrypoint: ["yarn", "dev", "--host", "0.0.0.0"]
|
||||
|
||||
nginx-prod:
|
||||
image: "${DOCKER_REGISTRY:-local}/excel-frontend-prod:${IMAGE_TAG:-local}"
|
||||
container_name: frontend-prod
|
||||
profiles: ["prod"]
|
||||
build:
|
||||
dockerfile: ./docker/dockerfile
|
||||
context: ../
|
||||
target: frontend_prod
|
||||
environment:
|
||||
- BACKEND_HOST=backend-prod
|
||||
- BACKEND_PORT=${BACKEND_PORT}
|
||||
init: true
|
||||
ipc: private
|
||||
ports:
|
||||
- "${FRONT_PORT}:80"
|
||||
networks:
|
||||
- backend
|
||||
restart: always
|
||||
|
||||
|
||||
|
||||
networks:
|
||||
backend:
|
||||
name: "${BACKEND_NETWORK:-backend_network}"
|
||||
@@ -37,6 +37,7 @@ RUN pip install --no-cache-dir poetry \
|
||||
&& poetry install --no-root --no-interaction --only main,web \
|
||||
&& pip uninstall -y poetry poetry-core poetry-plugin-export
|
||||
|
||||
|
||||
# --- Stage 2: Python Backend prod ---
|
||||
|
||||
FROM python:3.14-slim AS prod
|
||||
@@ -64,6 +65,7 @@ USER appuser
|
||||
|
||||
ENTRYPOINT ["./entrypoint.sh", "--prod"]
|
||||
|
||||
|
||||
# --- Stage 1: Python daemon builder ---
|
||||
|
||||
FROM python:3.14-slim AS worker-builder
|
||||
@@ -85,6 +87,7 @@ RUN pip install --no-cache-dir poetry \
|
||||
&& poetry install --no-root --no-interaction --only main,daemon \
|
||||
&& pip uninstall -y poetry poetry-core poetry-plugin-export
|
||||
|
||||
|
||||
# --- Stage 2: Python daemons ---
|
||||
|
||||
FROM python:3.14-slim AS daemon
|
||||
@@ -109,3 +112,54 @@ RUN groupadd --gid 1000 appuser \
|
||||
USER appuser
|
||||
|
||||
ENTRYPOINT ["python","-u", "daemon_run.py", "--all"]
|
||||
|
||||
|
||||
# --- Stage 1: Node Frontend builder ---
|
||||
|
||||
FROM node:24-alpine AS frontend-builder
|
||||
|
||||
LABEL org.opencontainers.image.title="The-DisExcel-project-prod"
|
||||
LABEL org.opencontainers.image.source="https://git.homyk.space/MH.Dmitrii/The_DisExcel_project"
|
||||
|
||||
WORKDIR /home/excel-project
|
||||
|
||||
COPY frontend/package.json frontend/yarn.lock ./
|
||||
|
||||
RUN yarn install --frozen-lockfile
|
||||
|
||||
COPY frontend/ ./
|
||||
|
||||
RUN yarn build
|
||||
|
||||
|
||||
# --- Stage 2: Node Frontend prod ---
|
||||
|
||||
FROM nginx:alpine AS frontend_prod
|
||||
|
||||
LABEL org.opencontainers.image.title="The-DisExcel-project-prod"
|
||||
LABEL org.opencontainers.image.source="https://git.homyk.space/MH.Dmitrii/The_DisExcel_project"
|
||||
|
||||
COPY --from=frontend-builder /home/excel-project/dist /usr/share/nginx/html
|
||||
|
||||
COPY docker/nginx/nginx.conf /etc/nginx/templates/default.conf.template
|
||||
|
||||
|
||||
# --- Stage 1: Node Frontend dev ---
|
||||
|
||||
FROM node:24-alpine AS frontend_dev
|
||||
|
||||
LABEL org.opencontainers.image.title="The-DisExcel-project-prod"
|
||||
LABEL org.opencontainers.image.source="https://git.homyk.space/MH.Dmitrii/The_DisExcel_project"
|
||||
|
||||
WORKDIR /home/excel-project
|
||||
|
||||
COPY frontend/package.json frontend/yarn.lock ./
|
||||
|
||||
RUN yarn install --frozen-lockfile
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
server {
|
||||
listen 80;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
try_files $uri /index.html;
|
||||
}
|
||||
|
||||
location /protected/ {
|
||||
proxy_pass http://${BACKEND_HOST}:${BACKEND_PORT};
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user