I have the following docker-compose.yml file:
docker-compose.staging.yml
:
version: '3.7'
services:
web:
restart: always
build: ./django
expose:
- "8000"
volumes:
- django-static:/usr/src/app/static
- django-uploads:/usr/src/app/uploads
environment:
DJANGO_POSTGRES_REMOTE: 'True'
DJANGO_POSTGRES_HOST: myservername.postgres.database.azure.com
DJANGO_POSTGRES_PORT: '1234'
DJANGO_POSTGRES_NAME: dbname
DJANGO_POSTGRES_USER: dbuser
DJANGO_POSTGRES_PASS: dbpassword
DJANGO_SECRET_KEY:
DJANGO_DEBUG: 1
DJANGO_TESTING: 0
DJANGO_WAVE_API_VERSION: '1'
DJANGO_WAVE_SUPERUSER_USERNAME: ''
DJANGO_WAVE_SUPERUSER_PASSWORD: ''
DJANGO_WAVE_SUPERUSER_EMAIL: ''
DJANGO_BUGSNAG_LOGGING_ENABLED: 0
DJANGO_BUGSNAG_API_KEY: ''
DJANGO_ROOT_DOMAIN: ''
DJANGO_MEMCACHED_ON: 'False'
VUE_ROOT_DOMAIN: ''
command: /usr/src/app/wave.sh
nginx:
build:
context: nginx
dockerfile: Dockerfile
restart: on-failure
ports:
- 80:80
- 443:443
volumes:
- ssl_data:/etc/resty-auto-ssl
environment:
ALLOWED_DOMAINS: "${STAGING_ALLOWED_DOMAINS}"
SITES: "${STAGING_SITES}"
volumes:
ssl_data:
django-static:
django-uploads:
I have tested this docker-compose file build process with the code, and all deploys fine:
docker-compose -f docker-compose.staging.yml up --build
My question is, I usually deploy automatically using docker-machine, which deploys a new virtual machine.
However, I am wondering, what is the procedure with docker-compose to publish this as an image to a Docker registry like Docker Hub? I have tried to search for an answer, but there doesn't seem to be anything that I can find.
Do I build two images from both services?
Is it possible to push two or more services from a docker-compose.yml file to Docker Hub (or similar)?