This commit is contained in:
2026-01-03 19:47:01 +03:00
parent 8c9ea53964
commit 151c98e994
3 changed files with 79 additions and 0 deletions

6
.dockerignore Normal file
View File

@@ -0,0 +1,6 @@
node_modules
.git
.gitignore
.gitattributes
README.md
DELIVER_MAN.slnx

13
Dockerfile.server Normal file
View File

@@ -0,0 +1,13 @@
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY server ./server
ENV NODE_ENV=production
EXPOSE 3000
CMD ["npm", "start"]

60
docker-compose.yml Normal file
View File

@@ -0,0 +1,60 @@
services:
db:
image: mariadb:11.4
environment:
MARIADB_DATABASE: delivery
MARIADB_USER: app
MARIADB_PASSWORD: app
MARIADB_ROOT_PASSWORD: root
volumes:
- db_data:/var/lib/mysql
- ./docker/init.sql:/docker-entrypoint-initdb.d/init.sql:ro
networks:
- backend
healthcheck:
test: ["CMD", "mariadb-admin", "ping", "-h", "localhost", "-u", "root", "-proot"]
interval: 10s
timeout: 5s
retries: 5
server:
build:
context: .
dockerfile: Dockerfile.server
environment:
HOST: db
PORT: 3306
DATABASE: delivery
USER: app
PASSWORD: app
depends_on:
db:
condition: service_healthy
networks:
- backend
- frontend
healthcheck:
test: ["CMD", "node", "-e", "fetch('http://localhost:3000/api/current-date').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"]
interval: 10s
timeout: 5s
retries: 5
client:
build:
context: .
dockerfile: Dockerfile.client
depends_on:
server:
condition: service_healthy
ports:
- "8080:80"
networks:
- frontend
volumes:
db_data:
networks:
backend:
internal: true
frontend: