services: app: image: todo-frontend-dev build: context: ./todo-frontend dockerfile: ./todo-frontend/dev.Dockerfile # This will simply tell which dockerfile to read volumes: - ./todo-frontend:/usr/src/app # The path can be relative, so ./ is enough to say "the same location as the docker-compose.yml" container_name: todo-front server: image: todo-backend-dev volumes: - ./todo-backend:/usr/src/app environment: REDIS_URL: "redis://redis:6379" MONGO_URL: "mongodb://the_username:the_password@mongo:27017/the_database" mongo: image: mongo environment: MONGO_INITDB_ROOT_USERNAME: root MONGO_INITDB_ROOT_PASSWORD: example MONGO_INITDB_DATABASE: the_database volumes: - ./todo-backend/mongo/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js - mongo_data:/data/db redis: image: redis command: ['redis-server', '--appendonly', 'yes'] # Overwrite the CMD volumes: # Declare the volume - ./todo-backend/redis_data:/data nginx: image: nginx:1.20.1 volumes: - ./nginx.dev.conf:/etc/nginx/nginx.conf:ro ports: - 8080:80 container_name: reverse-proxy-front-back depends_on: - app # wait for the frontend container to be started - server volumes: mongo_data: