我试图将我的应用程序移动到Docker。我目前正在使用fabric来部署我的Django应用程序。 我创建了一个docker-compose文件:
version: '3'
volumes:
static-files:
services:
nginx:
image: nginx:latest
volumes:
- ./deploy/conf/nginx.conf.template:/etc/nginx/conf.d/mysite.template
- static-files:/app/static
ports:
- "80:80"
environment:
- NGINX_HOST='localhost'
command: /bin/bash -c "envsubst '\$NGINX_HOST' < /etc/nginx/conf.d/mysite.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
depends_on:
- interface
redis:
image: redis:latest
db:
restart: always
image: mdillon/postgis:9.5
environment:
- POSTGRES_USER=production
- POSTGRES_PASSWORD=production
- POSTGRES_DB=production
interface:
restart: always
build: .
working_dir: /app/code/src
command: ["../../../wait-for-db.sh", "db", "./interface-entrypoint.sh"]
volumes:
- static-files:/app/static
environment:
- DJANGO_SETTINGS_MODULE=restapi.settings.production_settings
expose:
- "8001"
depends_on:
- db
- redis
workerserver:
restart: always
build: .
working_dir: /app/code/src
command: ["./worker-entrypoint.sh"]
environment:
- DJANGO_SETTINGS_MODULE=restapi.settings.production_settings
depends_on:
- db
- redis
- interface
这个docker-compose工作正常,我可以连接到服务器和所有。所以我的问题是: