Python web application project structure and docker support
I would use docker-compose
and do something like this example docker-compose.yml
web-app: build: . links: - postgresql - rabbitmq volumes_from: - configconfig: build: . dockerfile: dockerfiles/Dockerfile.configpostgresql: image: postgres:9.4 volumes_from: - postgresql-datapostgresql-data: build: dockerfiles/postgresql-data/nginx: build: . dockerfile: dockerfiles/Dockerfile.nginx links: - web-apprabbitmq: image: rabbitmq:3.5celery-worker: build: . dockerfile: dockerfiles/Dockerfile.celery-worker links: - rabbitmq
web-app
will use the default Dockerfile
in the project_root/
, all the other services will use a named dockerfile in a subdirectory (they can really be placed anywhere you want, they could be in the root as well). As long as the build
points at the root directory they will have access to all the files.
I would put your application configuration into a separate container and use volumes_from
to make it available to the application, so that you can use the same stateless app container with different configurations.
I think this satisfies all your requirements.