Add Docker deployment with automatic HTTPS
Deploy game to GitHub Pages / deploy (push) Failing after 21m51s
Deploy game to GitHub Pages / deploy (push) Failing after 21m51s
A two-stage image runs the tests and builds the game with Node, then serves dist/ with Caddy, which obtains and renews Let's Encrypt certificates for robotmarkets.ir (configurable via SITE_ADDRESS). HTTPS is required for installing the PWA and for GPS mode. - Caddyfile: gzip/zstd, long-lived caching for hashed assets, no-cache for the page, service worker and manifest, SPA fallback, permissions policy for location and motion sensors - docker-compose.yml: ports 80/443, persistent certificate volumes - README: server setup, updates, running behind an existing proxy, and workarounds when Docker Hub is unreachable from servers in Iran Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
# SITE_ADDRESS is the domain list, e.g. "robotmarkets.ir, www.robotmarkets.ir" (automatic HTTPS),
|
||||
# or ":80" for plain HTTP behind another proxy or for a local test.
|
||||
{$SITE_ADDRESS::80} {
|
||||
root * /srv
|
||||
encode zstd gzip
|
||||
|
||||
# Hashed build files never change; the page, service worker and manifest must always be revalidated
|
||||
# so installed copies pick up new versions.
|
||||
@hashed path /assets/*
|
||||
header @hashed Cache-Control "public, max-age=31536000, immutable"
|
||||
@fresh path / /index.html /sw.js /manifest.webmanifest
|
||||
header @fresh Cache-Control "no-cache"
|
||||
@manifest path /manifest.webmanifest
|
||||
header @manifest Content-Type "application/manifest+json"
|
||||
|
||||
header {
|
||||
X-Content-Type-Options nosniff
|
||||
Referrer-Policy strict-origin-when-cross-origin
|
||||
# Real-world mode needs location and the compass; the camera is reserved for the AR phase.
|
||||
Permissions-Policy "geolocation=(self), camera=(self), accelerometer=(self), gyroscope=(self), magnetometer=(self)"
|
||||
-Server
|
||||
}
|
||||
|
||||
try_files {path} /index.html
|
||||
file_server
|
||||
}
|
||||
Reference in New Issue
Block a user