test docker

This commit is contained in:
Zikil 2024-10-31 22:20:03 +07:00
parent f0c4c6ac2f
commit 90d9961592
3 changed files with 33 additions and 22 deletions

View File

@ -35,12 +35,10 @@
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["npm", "start"]
CMD ["npm", "start"]

View File

@ -27,24 +27,24 @@ services:
container_name: nextjs
restart: always
ports:
- "3000:3000"
- "3000:80"
networks:
- app-network
nginx:
image: nginx:alpine
container_name: nginx
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/conf.d:/etc/nginx/conf.d
- ./nginx/ssl:/etc/nginx/ssl
depends_on:
- nextjs
networks:
- app-network
restart: always
# nginx:
# image: nginx:alpine
# container_name: nginx
# ports:
# - "80:80"
# - "443:443"
# volumes:
# - ./nginx/conf.d:/etc/nginx/conf.d
# - ./nginx/ssl:/etc/nginx/ssl
# depends_on:
# - nextjs
# networks:
# - app-network
# restart: always
networks:
app-network:

View File

@ -20,16 +20,29 @@
# }
# }
# server {
# listen 80;
# server_name anthillsib.ru www.anthillsib.ru; # Замените на ваш домен
# location / {
# proxy_pass http://nextjs:3000;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection 'upgrade';
# proxy_set_header Host $host;
# proxy_cache_bypass $http_upgrade;
# }
# }
server {
listen 80;
server_name localhost:3000; # Замените на ваш домен
server_name localhost;
location / {
proxy_pass http://nextjs:3000;
proxy_pass http://app:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}