version: '3' services: flask: build: context: app dockerfile: Dockerfile container_name: flask image: digitalocean.com/flask-python:3.6 restart: unless-stopped environment: APP_ENV: "prod" APP_DEBUG: "False" APP_PORT: 5000 MONGODB_DATABASE: flaskdb MONGODB_USERNAME: flaskuser MONGODB_PASSWORD: your_password MONGODB_HOSTNAME: mongodb volumes: - appdata:/var/www depends_on: - mongodb networks: - frontend - backend mongodb: image: mongo:4.0.8 container_name: mongodb restart: unless-stopped command: mongod --auth environment: MONGO_INITDB_ROOT_USERNAME: mongodbuser MONGO_INITDB_ROOT_PASSWORD: your_mongodb_root_password MONGO_INITDB_DATABASE: flaskdb MONGODB_DATA_DIR: /data/db MONDODB_LOG_DIR: /dev/null volumes: - mongodbdata:/data/db networks: - backend webserver: build: context: nginx dockerfile: Dockerfile image: digitalocean.com/webserver:latest container_name: webserver restart: unless-stopped environment: APP_ENV: "prod" APP_NAME: "webserver" APP_DEBUG: "true" SERVICE_NAME: "webserver" ports: - "80:80" - "443:443" volumes: - nginxdata:/var/log/nginx depends_on: - flask networks: - frontend networks: frontend: driver: bridge backend: driver: bridge volumes: mongodbdata: driver: local appdata: driver: local nginxdata: driver: local