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 FROM node:18-alpine
WORKDIR /app WORKDIR /app
COPY package*.json ./ COPY package*.json ./
RUN npm install RUN npm install
COPY . . COPY . .
RUN npm run build
EXPOSE 3000 EXPOSE 3000
CMD ["npm", "start"] CMD ["npm", "start"]

View File

@ -27,24 +27,24 @@ services:
container_name: nextjs container_name: nextjs
restart: always restart: always
ports: ports:
- "3000:3000" - "3000:80"
networks: networks:
- app-network - app-network
nginx: # nginx:
image: nginx:alpine # image: nginx:alpine
container_name: nginx # container_name: nginx
ports: # ports:
- "80:80" # - "80:80"
- "443:443" # - "443:443"
volumes: # volumes:
- ./nginx/conf.d:/etc/nginx/conf.d # - ./nginx/conf.d:/etc/nginx/conf.d
- ./nginx/ssl:/etc/nginx/ssl # - ./nginx/ssl:/etc/nginx/ssl
depends_on: # depends_on:
- nextjs # - nextjs
networks: # networks:
- app-network # - app-network
restart: always # restart: always
networks: networks:
app-network: 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 { server {
listen 80; listen 80;
server_name localhost:3000; # Замените на ваш домен server_name localhost;
location / { location / {
proxy_pass http://nextjs:3000; proxy_pass http://app:3000;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade'; proxy_set_header Connection 'upgrade';
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
} }
} }