From 648284037ed2e7b011fbf179b5798f7d00cb487c Mon Sep 17 00:00:00 2001 From: adb-sh Date: Thu, 20 Oct 2022 23:59:00 +0200 Subject: [PATCH] update docker-compose; add dockerfile --- docker-compose.yml.example | 14 ++--- frontend | 2 +- nginx.conf | 104 ------------------------------------- 3 files changed, 4 insertions(+), 116 deletions(-) delete mode 100644 nginx.conf diff --git a/docker-compose.yml.example b/docker-compose.yml.example index 93c3b8b..64bab6e 100644 --- a/docker-compose.yml.example +++ b/docker-compose.yml.example @@ -27,18 +27,10 @@ services: - redis frontend: - image: node:16-alpine - volumes: - - ./frontend/:/home/node/app/frontend/ - working_dir: /home/node/app/frontend - command: sh -c 'npm i --also=dev && npm run build' - - nginx: - image: nginx:alpine + build: + context: ./frontend + dockerfile: ".Dockerfile" restart: always - volumes: - - ./nginx.conf:/etc/nginx/nginx.conf - - ./frontend/dist/:/var/www/html/ ports: - "8080:8080" links: diff --git a/frontend b/frontend index 27ab4c8..2ae7ad4 160000 --- a/frontend +++ b/frontend @@ -1 +1 @@ -Subproject commit 27ab4c870dd4f4b3bec5eb92c5f181ac00c17c55 +Subproject commit 2ae7ad4cef44048a4dcd68f82bb17d4f3f87c729 diff --git a/nginx.conf b/nginx.conf deleted file mode 100644 index c36ff97..0000000 --- a/nginx.conf +++ /dev/null @@ -1,104 +0,0 @@ -worker_processes auto; -worker_cpu_affinity auto; - -error_log /var/log/nginx/error.log; -pid /var/run/nginx.pid; - -#daemon off; -events { - worker_connections 1024; -} - -http { -# rewrite_log on; - include mime.types; - default_type application/json; - access_log /var/log/nginx/access.log; - sendfile on; -# tcp_nopush on; - keepalive_timeout 3; -# tcp_nodelay on; -# gzip on; - client_max_body_size 1m; - proxy_cache_path ./cache/ keys_zone=public_api_cache:1m; - - server { - listen 8080 default_server; - server_name _; - - error_page 400 = @400; - location @400 { return 400 '{"status":400,"message":"Bad request"}\n'; } - - error_page 401 = @401; - location @401 { return 401 '{"status":401,"message":"Unauthorized"}\n'; } - - error_page 403 = @403; - location @403 { return 403 '{"status":403,"message":"Forbidden"}\n'; } - - error_page 404 = @404; - location @404 { return 404 '{"status":404,"message":"Resource not found"}\n'; } - - error_page 405 = @405; - location @405 { return 405 '{"status":405,"message":"Method not allowed"}\n'; } - - error_page 408 = @408; - location @408 { return 408 '{"status":408,"message":"Request timeout"}\n'; } - - error_page 413 = @413; - location @413 { return 413 '{"status":413,"message":"Payload too large"}\n'; } - - error_page 414 = @414; - location @414 { return 414 '{"status":414,"message":"Request URI too large"}\n'; } - - error_page 415 = @415; - location @415 { return 415 '{"status":415,"message":"Unsupported media type"}\n'; } - - error_page 426 = @426; - location @426 { return 426 '{"status":426,"message":"HTTP request was sent to HTTPS port"}\n'; } - - error_page 429 = @429; - location @429 { return 429 '{"status":429,"message":"API rate limit exceeded"}\n'; } - - error_page 495 = @495; - location @495 { return 495 '{"status":495,"message":"Client certificate authentication error"}\n'; } - - error_page 496 = @496; - location @496 { return 496 '{"status":496,"message":"Client certificate not presented"}\n'; } - - error_page 497 = @497; - location @497 { return 497 '{"status":497,"message":"HTTP request was sent to mutual TLS port"}\n'; } - - error_page 500 = @500; - location @500 { return 500 '{"status":500,"message":"Server error"}\n'; } - - error_page 501 = @501; - location @501 { return 501 '{"status":501,"message":"Not implemented"}\n'; } - - error_page 502 = @502; - location @502 { return 502 '{"status":502,"message":"Bad gateway"}\n'; } - - - location / { - index index.html; - root /var/www/html; - try_files $uri $uri/ /index.html; - } - - location /api/public { - add_header "Access-Control-Allow-Origin" *; - add_header "Access-Control-Allow-Methods" "GET, POST, OPTIONS, HEAD, DELETE"; - add_header "Access-Control-Allow-Headers" "Authorization, Origin, X-Requested-With, Content-Type, Accept"; - add_header X-Cache-Status $upstream_cache_status; - - proxy_cache public_api_cache; - proxy_cache_valid 200 8s; - default_type application/json; - proxy_pass http://backend:3000; - } - - location /api { - default_type application/json; - proxy_pass http://backend:3000; - } - } -}