Created
December 19, 2022 20:18
-
-
Save exaland/8bf4312ad2c0095da491ef1d35f835c1 to your computer and use it in GitHub Desktop.
Stapi with Mongodb
This file contains 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" | |
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: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
.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