From e140657ce2b7a82772867090239cabe75b5848cc Mon Sep 17 00:00:00 2001 From: Matt Isenhower Date: Thu, 14 Nov 2024 22:00:09 -0800 Subject: [PATCH] Update Docker Compose configs --- docker-compose.override.yml.dev.example | 14 ++++++ docker-compose.override.yml.example | 20 -------- docker-compose.override.yml.prod.example | 17 +++++++ docker-compose.yml | 12 ++--- docker/nginx/conf.d/default.conf | 60 ------------------------ 5 files changed, 34 insertions(+), 89 deletions(-) create mode 100644 docker-compose.override.yml.dev.example delete mode 100644 docker-compose.override.yml.example create mode 100644 docker-compose.override.yml.prod.example delete mode 100644 docker/nginx/conf.d/default.conf diff --git a/docker-compose.override.yml.dev.example b/docker-compose.override.yml.dev.example new file mode 100644 index 0000000..990065b --- /dev/null +++ b/docker-compose.override.yml.dev.example @@ -0,0 +1,14 @@ +# Example Docker Compose override file for local development + +services: + app: + platform: linux/amd64 # Needed for Apple Silicon + build: + dockerfile: docker/app/Dockerfile + volumes: + - .:/app + + browserless: + platform: linux/arm64 # Needed for Apple Silicon + ports: + - 3000:3000 diff --git a/docker-compose.override.yml.example b/docker-compose.override.yml.example deleted file mode 100644 index 9bcc4c4..0000000 --- a/docker-compose.override.yml.example +++ /dev/null @@ -1,20 +0,0 @@ -version: '2' - -# This adds config options for use with nginx-proxy: -# https://github.com/jwilder/nginx-proxy - -# Alternatively, a public port for nginx could be exposed here. - -services: - - nginx: - environment: - VIRTUAL_HOST: splatoon2.ink,www.splatoon2.ink - networks: - - default - - nginx-proxy - -networks: - nginx-proxy: - external: - name: nginxproxy_default diff --git a/docker-compose.override.yml.prod.example b/docker-compose.override.yml.prod.example new file mode 100644 index 0000000..dbac9f1 --- /dev/null +++ b/docker-compose.override.yml.prod.example @@ -0,0 +1,17 @@ +# Example Docker Compose override file for production + +services: + app: + # Use a different tag if needed + # image: ghcr.io/misenhower/splatoon2.ink:develop + labels: [ "com.centurylinklabs.watchtower.scope=devsplatoon2ink" ] + + browserless: + labels: [ "com.centurylinklabs.watchtower.scope=devsplatoon2ink" ] + + watchtower: + image: containrrr/watchtower + volumes: + - /var/run/docker.sock:/var/run/docker.sock + command: --interval 30 --scope devsplatoon2ink + labels: [ "com.centurylinklabs.watchtower.scope=devsplatoon2ink" ] diff --git a/docker-compose.yml b/docker-compose.yml index 261a3b6..b1d3480 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,6 @@ services: app: - build: - dockerfile: docker/app/Dockerfile + image: ghcr.io/misenhower/splatoon2.ink init: true restart: unless-stopped environment: @@ -10,16 +9,11 @@ services: SCREENSHOT_HOST: app depends_on: - browserless + env_file: + - .env browserless: image: ghcr.io/browserless/chromium restart: unless-stopped environment: CONCURRENT: ${BROWSERLESS_CONCURRENT:-1} - - nginx: - image: nginx - restart: unless-stopped - volumes: - - ./docker/nginx/conf.d:/etc/nginx/conf.d:ro - - ./dist:/usr/share/nginx/html:ro diff --git a/docker/nginx/conf.d/default.conf b/docker/nginx/conf.d/default.conf deleted file mode 100644 index f20599c..0000000 --- a/docker/nginx/conf.d/default.conf +++ /dev/null @@ -1,60 +0,0 @@ -# Rate limiting zone (Note: 10m is the size of the address pool, not time) -limit_req_zone $binary_remote_addr zone=main:10m rate=10r/s; - -server { - listen 80 default_server; - - root /usr/share/nginx/html; - index index.html; - - charset utf-8; - charset_types application/json; - - # Docker reverse proxy IP passthrough - set_real_ip_from 172.16.0.0/12; - real_ip_header X-Real-IP; - - # Log to the main (Docker stdout) log - access_log /var/log/nginx/access.log; - - # Rate limiting: allow bursts with no delay - limit_req zone=main burst=500 nodelay; - - location / { - try_files $uri $uri/ /index.html; - } - - # Force browsers to check for updated data - location /data/ { - add_header Cache-Control no-cache; - add_header Access-Control-Allow-Origin *; - autoindex on; - } - - location /twitter-images/ { - add_header Cache-Control no-cache; - add_header Access-Control-Allow-Origin *; - } - - location ~ \.ics$ { - add_header Content-Type text/calendar; - } - - # CORS (for modern ES module support and third-party integrations) - location /assets/ { - add_header Access-Control-Allow-Origin *; - } - - # Block access to the file used for screenshots - location = /screenshots.html { - internal; - } -} - -# Redirect www to non-www -server { - listen 80; - - server_name www.splatoon2.ink; - return 301 $scheme://splatoon2.ink$request_uri; -}