-
-
Save Timures/c03102218e21e409398efc7e0d2d3d88 to your computer and use it in GitHub Desktop.
Nuxt 3 Docker example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.3" | |
# Указываем раздел со связанными сервисами | |
services: | |
nginx: | |
depends_on: | |
- nuxt | |
image: nginx:latest | |
ports: | |
- '80:80' | |
volumes: | |
# Используем свой nginx конфиг, он заменит дефолтный в контейнере | |
- ./nginx:/etc/nginx/conf.d | |
# Монтируем папку с логами на хост машину для более удобного доступа | |
- ./logs:/var/log/nginx/ | |
restart: always | |
nuxt: | |
build: ./nuxt | |
expose: | |
- '3000' | |
restart: always |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:18.16.0 | |
ENV APP_ROOT /web | |
WORKDIR ${APP_ROOT} | |
ADD . ${APP_ROOT} | |
RUN npm ci | |
RUN npm run build | |
CMD node .output/server/index.mjs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map $sent_http_content_type $expires { | |
"text/html" epoch; | |
"text/html; charset=utf-8" epoch; | |
default off; | |
} | |
server { | |
listen 80 default_server; | |
gzip on; | |
gzip_types text/plain application/xml text/css application/javascript; | |
gzip_min_length 1000; | |
location / { | |
expires $expires; | |
proxy_redirect off; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_read_timeout 1m; | |
proxy_connect_timeout 1m; | |
proxy_pass http://nuxt:3000; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment