1
0
mirror of https://github.com/robonen/canvas-3d.git synced 2026-03-20 02:44:40 +00:00

feat(repo): docker-compose config and nginx config

This commit is contained in:
2022-11-13 02:54:43 +07:00
parent 5b4b190c2c
commit 36f2503002
2 changed files with 104 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
server {
listen 80;
resolver 127.0.0.11 ipv6=off valid=10s;
# . files
location ~ /\.(?!well-known) {
deny all;
}
# logging
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log warn;
# reverse proxy
location / {
proxy_pass http://app:3000$request_uri;
proxy_set_header Host $host;
proxy_http_version 1.1;
# proxy headers
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-Host $server_name;
# proxy timeouts
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
}
# favicon.ico
location = /favicon.ico {
log_not_found off;
}
# robots.txt
location = /robots.txt {
log_not_found off;
}
# gzip
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;
}

View File

@@ -0,0 +1,55 @@
version: '3'
services:
proxy:
container_name: proxy
image: nginx:latest
ports:
- '${PROXY_PORT:-80}:80'
- '${PROXY_PORT_SSL:-443}:443'
volumes:
- './config/nginx/proxy.conf:/etc/nginx/conf.d/default.conf'
networks:
- c3d_net
depends_on:
- app
app:
container_name: app
build:
context: .
dockerfile: Dockerfile
ports:
- '${FORWARD_APP_PORT:-3000}:3000'
networks:
- c3d_net
depends_on:
- db
db:
container_name: db
image: 'postgres:latest'
ports:
- '${FORWARD_DB_PORT:-5432}:5432'
environment:
PGPASSWORD: '${DB_PASSWORD:-secret}'
POSTGRES_DB: '${DB_DATABASE}'
POSTGRES_USER: '${DB_USERNAME}'
POSTGRES_PASSWORD: '${DB_PASSWORD:-secret}'
volumes:
- 'c3d_vol:/var/lib/postgresql/data'
networks:
- c3d_net
healthcheck:
test: [ "CMD", "pg_isready", "-q", "-d", "${DB_DATABASE}", "-U", "${DB_USERNAME}" ]
retries: 3
timeout: 5s
volumes:
c3d_vol:
driver: local
networks:
c3d_net:
driver: bridge