update docker
This commit is contained in:
parent
7ab1fdca74
commit
efefdeedc7
@ -1,5 +1,8 @@
|
|||||||
# Backend Dockerfile
|
# 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
|
# Set working directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@ -8,7 +11,7 @@ WORKDIR /app
|
|||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN npm ci --only=production
|
RUN npm install --only=production
|
||||||
|
|
||||||
# Copy source code
|
# Copy source code
|
||||||
COPY . .
|
COPY . .
|
||||||
@ -24,4 +27,4 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|||||||
CMD curl -f http://localhost:3001/health || exit 1
|
CMD curl -f http://localhost:3001/health || exit 1
|
||||||
|
|
||||||
# Start application
|
# Start application
|
||||||
CMD ["npm", "start"]
|
CMD ["npm", "start"]
|
@ -4,11 +4,11 @@ FROM nginx:alpine
|
|||||||
# Copy static files
|
# Copy static files
|
||||||
COPY . /usr/share/nginx/html/
|
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 port
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
# Start nginx
|
# Start nginx
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
CMD ["nginx", "-g", "daemon off;"]
|
@ -1,24 +1,21 @@
|
|||||||
version: '3.8'
|
version: '3.8'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
# Frontend Service
|
# Frontend Service
|
||||||
frontend:
|
frontend:
|
||||||
build:
|
build:
|
||||||
context: ./frontend
|
context: ../frontend
|
||||||
dockerfile: Dockerfile
|
dockerfile: ../docker/Dockerfile.frontend
|
||||||
container_name: cash_system_frontend
|
container_name: cash_system_frontend
|
||||||
ports:
|
ports:
|
||||||
- "3000:80"
|
- "3000:80"
|
||||||
depends_on:
|
|
||||||
- backend
|
|
||||||
networks:
|
networks:
|
||||||
- cash_system_network
|
- cash_system_network
|
||||||
|
|
||||||
# Backend Service
|
# Backend Service
|
||||||
backend:
|
backend:
|
||||||
build:
|
build:
|
||||||
context: ./backend
|
context: ../backend
|
||||||
dockerfile: Dockerfile
|
dockerfile: ../docker/Dockerfile.backend
|
||||||
container_name: cash_system_backend
|
container_name: cash_system_backend
|
||||||
ports:
|
ports:
|
||||||
- "3001:3001"
|
- "3001:3001"
|
||||||
@ -27,10 +24,10 @@ services:
|
|||||||
- PORT=3001
|
- PORT=3001
|
||||||
- DB_PATH=/app/data/database.sqlite
|
- DB_PATH=/app/data/database.sqlite
|
||||||
volumes:
|
volumes:
|
||||||
- ./data:/app/data
|
- ../data:/app/data
|
||||||
networks:
|
networks:
|
||||||
- cash_system_network
|
- cash_system_network
|
||||||
|
|
||||||
# Nginx Reverse Proxy
|
# Nginx Reverse Proxy
|
||||||
nginx:
|
nginx:
|
||||||
image: nginx:alpine
|
image: nginx:alpine
|
||||||
@ -38,7 +35,7 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "80:80"
|
||||||
volumes:
|
volumes:
|
||||||
- ./docker/nginx.conf:/etc/nginx/nginx.conf
|
- ./nginx.conf:/etc/nginx/nginx.conf
|
||||||
depends_on:
|
depends_on:
|
||||||
- frontend
|
- frontend
|
||||||
- backend
|
- backend
|
||||||
@ -50,4 +47,4 @@ networks:
|
|||||||
driver: bridge
|
driver: bridge
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
database_data:
|
database_data:
|
@ -10,11 +10,11 @@ http {
|
|||||||
upstream backend {
|
upstream backend {
|
||||||
server backend:3001;
|
server backend:3001;
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name localhost;
|
server_name localhost;
|
||||||
|
|
||||||
# Frontend routes
|
# Frontend routes
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://frontend;
|
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-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
# API routes
|
# API routes
|
||||||
location /api/ {
|
location /api/ {
|
||||||
proxy_pass http://backend;
|
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-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Static files
|
# Static files
|
||||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
||||||
proxy_pass http://frontend;
|
proxy_pass http://frontend;
|
||||||
@ -40,4 +40,4 @@ http {
|
|||||||
add_header Cache-Control "public, immutable";
|
add_header Cache-Control "public, immutable";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
//API
|
//API
|
||||||
const API_BASE_URL = "http://localhost:3001/api";
|
const API_BASE_URL = "http://195.209.214.159/api";
|
||||||
|
|
||||||
//Login
|
//Login
|
||||||
async function loginUser(username, password) {
|
async function loginUser(username, password) {
|
||||||
|
Loading…
Reference in New Issue
Block a user