1
0
mirror of https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git synced 2025-08-14 00:25:46 +02:00

change docker

This commit is contained in:
MoonTestUse1
2024-12-24 00:12:56 +06:00
parent ab67dee15f
commit b5bb8c3d73
2 changed files with 33 additions and 14 deletions

View File

@@ -3,34 +3,44 @@ version: '3.8'
services: services:
frontend: frontend:
build: build:
context: . context: ./frontend
dockerfile: docker/frontend/Dockerfile dockerfile: ../docker/frontend/Dockerfile
container_name: support-frontend container_name: support-frontend
restart: unless-stopped
volumes: volumes:
- frontend_build:/app/dist - ./frontend:/app
- /app/node_modules
ports:
- "3000:80"
backend: backend:
build: build:
context: . context: ./backend
dockerfile: docker/backend/Dockerfile dockerfile: ../docker/backend/Dockerfile
container_name: support-backend container_name: support-backend
restart: unless-stopped
environment: environment:
- TELEGRAM_BOT_TOKEN=7677506032:AAHEqNUr1lIUfNVbLwaWIaPeKKShsCyz3eo - TELEGRAM_BOT_TOKEN=7677506032:AAHEqNUr1lIUfNVbLwaWIaPeKKShsCyz3eo
- TELEGRAM_CHAT_ID=-1002037023574 - TELEGRAM_CHAT_ID=-1002037023574
volumes:
- ./backend:/app
- sqlite_data:/app/instance
ports: ports:
- "8000:8000" - "8000:8000"
nginx: nginx:
image: nginx:alpine image: nginx:alpine
container_name: support-nginx container_name: support-nginx
restart: unless-stopped
ports: ports:
- "80:80" - "80:80"
volumes: volumes:
- frontend_build:/usr/share/nginx/html:ro - ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./docker/nginx/conf.d:/etc/nginx/conf.d:ro - ./docker/nginx/conf.d:/etc/nginx/conf.d:ro
- ./frontend/dist:/usr/share/nginx/html:ro
depends_on: depends_on:
- frontend - frontend
- backend - backend
volumes: volumes:
frontend_build: sqlite_data:

View File

@@ -1,19 +1,28 @@
# Этап сборки
FROM node:18-alpine as builder FROM node:18-alpine as builder
WORKDIR /app WORKDIR /app
# Копируем файлы package.json # Копируем файлы package.json и package-lock.json
COPY frontend/package*.json ./ COPY package*.json ./
# Устанавливаем зависимости # Устанавливаем зависимости
RUN npm ci RUN npm ci
# Копируем исходники # Копируем исходный код
COPY frontend/ ./ COPY . .
# Собираем приложение # Собираем приложение
RUN npm run build RUN npm run build
# Финальный этап # Этап production
FROM scratch FROM nginx:alpine
COPY --from=builder /app/dist /dist
# Копируем собранные файлы из этапа сборки
COPY --from=builder /app/dist /usr/share/nginx/html
# Копируем конфигурацию nginx
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Указываем команду для запуска nginx
CMD ["nginx", "-g", "daemon off;"]