Skip to content

Instantly share code, notes, and snippets.

@LuisEGR
Last active June 10, 2022 17:34
Show Gist options
  • Save LuisEGR/9c05bc1478d69b534459e8536e4df3a9 to your computer and use it in GitHub Desktop.
Save LuisEGR/9c05bc1478d69b534459e8536e4df3a9 to your computer and use it in GitHub Desktop.
Example docker compose with air - go live-reload
version: "3.3"
services:
mongodb:
image : mongo
container_name: mongo-my-app
ports:
- 27018:27017
restart: always
volumes:
- mongo-vol:/data/db
environment:
- MONGO_INITDB_ROOT_USERNAME=user
- MONGO_INITDB_ROOT_PASSWORD=pass
## Postgres, redis, minio, etc ...
my-app:
image: cosmtrek/air
# working_dir value has to be the same of mapped volume
working_dir: /project
ports:
- 8000:8000
volumes:
- ./:/project/
links:
- mongodb
container_name: my-app
environment:
- PORT=8000
- MONGO_HOST=mongodb
- MONGO_USER=user
- MONGO_PASSWORD=pass
- MONGO_PORT=27018
- MONGO_DATABASE=test
volumes:
mongo-vol:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment