Skip to content

Instantly share code, notes, and snippets.

@davidbbe
Created October 28, 2022 02:39
Show Gist options
  • Save davidbbe/291a15cee45de643673612d4e418e3d3 to your computer and use it in GitHub Desktop.
Save davidbbe/291a15cee45de643673612d4e418e3d3 to your computer and use it in GitHub Desktop.
services:
uwsgi:
platform: linux/amd64
build: .
image: tomgobravo/tourist-with-flask:tourist-docker
command: uwsgi --strict --need-app --ini /app/uwsgi.ini
environment:
FLASK_ENV: "production"
volumes:
- /var/local/www-data:/data
- ./tourist/secrets.cfg:/app/tourist/secrets.cfg
# Run as the host www-data by replacing the container passwd and group files.
# Within the container the uid on files will now map to names from the host (if any)
# but that's okay because the container filesystem can be treated as readonly; uwsgi
# only needs to write to /data, which is mounted from the host filesystem.
# https://pawitp.medium.com/syncing-host-and-container-users-in-docker-39337eff0094
# The service prefectagentproduction does the same.
- /etc/passwd:/etc/passwd:ro
- /etc/group:/etc/group:ro
user: "www-data:www-data"
# This container doesn't really need anything else running to start so a
# systemd configuration like
# https://www.jetbrains.com/help/youtrack/server/run-docker-container-as-service.html
# isn't needed.
restart: unless-stopped
prefectagentproduction:
platform: linux/amd64
build: .
image: tomgobravo/tourist-with-flask:tourist-docker
command: prefect agent start -q production
environment:
PREFECT_HOME: "/prefect_home"
volumes:
- /var/local/www-data/tourist-prefect-agent/.prefect:/prefect_home
- /var/local/www-data:/data
# See comment about users in service uwsgi.
- /etc/passwd:/etc/passwd:ro
- /etc/group:/etc/group:ro
user: "www-data:www-data"
restart: unless-stopped
flaskdebugrun:
platform: linux/amd64
build: .
command: flask run
environment:
FLASK_ENV: "development"
FLASK_RUN_HOST: "0.0.0.0"
ports:
- "5000:5000"
volumes:
- ./dev-data:/data
- ./tourist:/app/tourist
prefectagentdevelopment:
platform: linux/amd64
build: .
image: tomgobravo/tourist-with-flask:tourist-docker
command: prefect agent start -q development
network_mode: host
environment:
PREFECT_API_URL: "http://127.0.0.1:4200/api"
volumes:
- ./dev-data:/data
- ./tourist:/app/tourist
prefectoriondevelopment:
platform: linux/amd64
build: .
image: tomgobravo/tourist-with-flask:tourist-docker
command: prefect orion start
# Use network_mode: host because so the local orion server which listens to 127.0.0.1 by
# default is reachable from a browser on the host and by prefectagentdevelopment.
network_mode: host
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment