Last active
June 10, 2022 17:34
-
-
Save LuisEGR/9c05bc1478d69b534459e8536e4df3a9 to your computer and use it in GitHub Desktop.
Example docker compose with air - go live-reload
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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