strapi-docker
strapi-docker copied to clipboard
Docker secrets
Allow database password to be defined in a file via the DATABASE_PASSWORD_FILE
environment variable.
This adds support for Docker secrets in a Docker swarm.
Typical use would be as follows (this assumes the 1database-password` secret has been created outside of the strapi stack):
#docker-compsoe.yml
version: "3"
secrets:
database-password:
external: true
services:
strapi:
container_name: strapi
image: strapi/strapi
environment:
- NODE_ENV=production
- DATABASE_CLIENT=postgres
- DATABASE_HOST=db
- DATABASE_PORT=5432
- DATABASE_NAME=strapi
- DATABASE_USERNAME=strapi
- DATABASE_PASSWORD_FILE=/run/secrets/database-password
ports:
- 1337:1337
volumes:
- ./app:/srv/app
secrets:
- database-password
depends_on:
- db
command: 'strapi start'