Created
April 24, 2025 08:18
-
-
Save davidwtbuxton/746b4c919097072527e816dacb094e4e to your computer and use it in GitHub Desktop.
Revisions
-
davidwtbuxton created this gist
Apr 24, 2025 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ # Nginx will listen on localhost:8080, serving static assets and doing gzip compression. services: app: image: python:3.13-alpine ports: ["8000:8000"] command: ["python", "-m", "http.server"] nginx: build: dockerfile: nginx.dockerfile ports: ["8080:8080"] environment: PORT: "8080" APP_PORT: "8000" APP_HOST: "app" 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ # Nginx server configuration. server { listen ${PORT}; gzip on; gzip_types application/atom+xml application/javascript application/json application/rss+xml application/vnd.ms-excel application/xml image/svg+xml image/jpeg image/gif image/png image/webp text/css text/html text/plain text/xml ; location / { root /usr/share/nginx/html; index index.html; try_files $uri $uri/ @app; } location @app { proxy_pass http://${APP_HOST}:${APP_PORT}; } } 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ # A custom nginx image including our static assets. This (mostly) works when running # in Cloud Run, with $PORT usually provided as "8000", but with sidecar containers # listening on 127.0.0.1 (which is different to Docker compose, where services have # their own service name on a shared network). FROM nginx:1.28-alpine ENV APP_PORT=8000 ENV APP_HOST=127.0.0.1 ENV PORT=80 RUN rm /usr/share/nginx/html/index.html COPY nginx-default.conf.template /etc/nginx/templates/default.conf.template COPY static /usr/share/nginx/html/