Skip to content

Instantly share code, notes, and snippets.

@exaland
Created December 19, 2022 20:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save exaland/8bf4312ad2c0095da491ef1d35f835c1 to your computer and use it in GitHub Desktop.
Save exaland/8bf4312ad2c0095da491ef1d35f835c1 to your computer and use it in GitHub Desktop.
Stapi with Mongodb
version: "3"
services:
strapiexample:
image: strapi/strapi
container_name: strapiexample
restart: unless-stopped
env_file: .env
environment:
DATABASE_CLIENT: ${DATABASE_CLIENT}
DATABASE_NAME: ${DATABASE_NAME}
DATABASE_HOST: ${DATABASE_HOST}
DATABASE_PORT: ${DATABASE_PORT}
DATABASE_USERNAME: ${DATABASE_USERNAME}
DATABASE_PASSWORD: ${DATABASE_PASSWORD}
# links:
# - mongo:mongo
networks:
- strapi-app-network
volumes:
- ./apps:/srv/app
ports:
- "1337:1337"
mongoexample:
image: mongo
container_name: mongoexample
restart: unless-stopped
env_file: .env
environment:
MONGO_INITDB_ROOT_USERNAME: ${MONGO_INITDB_ROOT_USERNAME}
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_INITDB_ROOT_PASSWORD}
networks:
- strapi-app-network
volumes:
- strapidata:/data/db
ports:
- "27017:27017"
networks:
strapi-app-network:
driver: bridge
volumes:
strapidata:
@exaland
Copy link
Author

exaland commented Dec 19, 2022

.env file

DATABASE_CLIENT=mongo
DATABASE_NAME=strapi
DATABASE_HOST=mongoexample
DATABASE_PORT=27017
DATABASE_USERNAME=strapi
DATABASE_PASSWORD=password
MONGO_INITDB_ROOT_USERNAME=strapi
MONGO_INITDB_ROOT_PASSWORD=password

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