Skip to content

Instantly share code, notes, and snippets.

@MiguelMateoTavarez
Last active December 28, 2023 18:46
Show Gist options
  • Save MiguelMateoTavarez/768dd4ec54d07a6c1ade9abfe94185d5 to your computer and use it in GitHub Desktop.
Save MiguelMateoTavarez/768dd4ec54d07a6c1ade9abfe94185d5 to your computer and use it in GitHub Desktop.
docker-compose for mongo and mongo-express
version: "3"
services:
mongo:
container_name: ${MONGO_DB_NAME}
image: mongo:6.0
volumes:
- poke-vol:/data/db
ports:
- ${MONGO_HOST_PORT}:${MONGO_CONTAINER_PORT}
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: ${MONGO_USERNAME}
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_PASSWORD}
command: ['--auth']
mongo-express:
depends_on:
- mongo
container_name: ${MONGO_EXPRESS_NAME}
image: mongo-express:1.0.0-20-alpine3.17
restart: always
environment:
ME_CONFIG_OPTIONS_EDITORTHEME: "ambiance"
ME_CONFIG_MONGODB_ADMINUSERNAME: ${MONGO_USERNAME}
ME_CONFIG_MONGODB_ADMINPASSWORD: ${MONGO_PASSWORD}
ME_CONFIG_MONGODB_SERVER: mongo
ME_CONFIG_MONGODB_PORT: ${MONGO_CONTAINER_PORT}
ME_CONFIG_BASICAUTH_USERNAME: ${MONGO_USERAUTH}
ME_CONFIG_BASICAUTH_PASSWORD: ${MONGO_PASSAUTH}
links:
- mongo
ports:
- ${MONGO_EXPRESS_HOST_PORT}:${MONGO_EXPRESS_CONTAINER_PORT}
poke-app:
depends_on:
- mongo
- mongo-express
image: klerith/pokemon-nest-app:1.0.0
ports:
- ${POKE_APP_HOST_PORT}:${POKE_APP_CONTAINER_PORT}
restart: always
environment:
MONGODB: mongodb://${MONGO_USERNAME}:${MONGO_PASSWORD}@${MONGO_DB_NAME}:${MONGO_CONTAINER_PORT}
DB_NAME: ${POKE_APP_DB_NAME}
volumes:
poke-vol:
external: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment