update docker

This commit is contained in:
NW 2025-07-29 03:04:59 +00:00
parent 7ab1fdca74
commit efefdeedc7
5 changed files with 24 additions and 24 deletions

View File

@ -1,5 +1,8 @@
# Backend Dockerfile
FROM node:16-alpine
FROM node:18-slim
# Установка зависимостей для сборки нативных модулей
RUN apt-get update && apt-get install -y python3 build-essential curl && apt-get clean
# Set working directory
WORKDIR /app
@ -8,7 +11,7 @@ WORKDIR /app
COPY package*.json ./
# Install dependencies
RUN npm ci --only=production
RUN npm install --only=production
# Copy source code
COPY . .
@ -24,4 +27,4 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:3001/health || exit 1
# Start application
CMD ["npm", "start"]
CMD ["npm", "start"]

View File

@ -4,11 +4,11 @@ FROM nginx:alpine
# Copy static files
COPY . /usr/share/nginx/html/
# Copy nginx config
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Устанавливаем правильные права
RUN chmod -R 755 /usr/share/nginx/html/
# Expose port
EXPOSE 80
# Start nginx
CMD ["nginx", "-g", "daemon off;"]
CMD ["nginx", "-g", "daemon off;"]

View File

@ -1,24 +1,21 @@
version: '3.8'
services:
# Frontend Service
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
context: ../frontend
dockerfile: ../docker/Dockerfile.frontend
container_name: cash_system_frontend
ports:
- "3000:80"
depends_on:
- backend
networks:
- cash_system_network
# Backend Service
backend:
build:
context: ./backend
dockerfile: Dockerfile
context: ../backend
dockerfile: ../docker/Dockerfile.backend
container_name: cash_system_backend
ports:
- "3001:3001"
@ -27,10 +24,10 @@ services:
- PORT=3001
- DB_PATH=/app/data/database.sqlite
volumes:
- ./data:/app/data
- ../data:/app/data
networks:
- cash_system_network
# Nginx Reverse Proxy
nginx:
image: nginx:alpine
@ -38,7 +35,7 @@ services:
ports:
- "80:80"
volumes:
- ./docker/nginx.conf:/etc/nginx/nginx.conf
- ./nginx.conf:/etc/nginx/nginx.conf
depends_on:
- frontend
- backend
@ -50,4 +47,4 @@ networks:
driver: bridge
volumes:
database_data:
database_data:

View File

@ -10,11 +10,11 @@ http {
upstream backend {
server backend:3001;
}
server {
listen 80;
server_name localhost;
# Frontend routes
location / {
proxy_pass http://frontend;
@ -23,7 +23,7 @@ http {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# API routes
location /api/ {
proxy_pass http://backend;
@ -32,7 +32,7 @@ http {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Static files
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
proxy_pass http://frontend;
@ -40,4 +40,4 @@ http {
add_header Cache-Control "public, immutable";
}
}
}
}

View File

@ -1,5 +1,5 @@
//API
const API_BASE_URL = "http://localhost:3001/api";
const API_BASE_URL = "http://195.209.214.159/api";
//Login
async function loginUser(username, password) {