Skip to content

Instantly share code, notes, and snippets.

@kanzitelli
Created September 12, 2019 18:31
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kanzitelli/1b9094ef91c51290c0b4809d51d41247 to your computer and use it in GitHub Desktop.
Save kanzitelli/1b9094ef91c51290c0b4809d51d41247 to your computer and use it in GitHub Desktop.
Docker Compose file with Traefik, Backend and MongoDB configured. For running locally.
version: '3'
services:
reverse-proxy:
image: traefik:v2.0
container_name: traefik
command: --api --providers.docker
ports:
- "6969:80"
- "6970:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
api:
build: ./
restart: always
container_name: api
environment:
- API_DEBUGMODE=${API_GIN_DEBUG_MODE}
- API_MONGODBNAME=${MONGO_DB_NAME}
- API_MONGODBURL=mongodb://${MONGO_DB_USER}:${MONGO_DB_PSWD}@mongo:27017/${MONGO_DB_NAME}
depends_on:
- mongo
labels:
- "traefik.enable=true"
- "traefik.http.routers.api.rule=Host(`localhost`)"
mongo:
image: mongo
restart: always
container_name: mongo
environment:
- MONGO_INITDB_ROOT_USERNAME=${MONGO_ADMIN}
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_ADMIN_PSWD}
volumes:
- ./appdata/db:/data/db
labels:
- "traefik.enable=false"
@dennis-eichardt-CH
Copy link

Thank you. This really helped me a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment