strapi-docker icon indicating copy to clipboard operation
strapi-docker copied to clipboard

Docker secrets

Open opichon opened this issue 3 years ago • 1 comments

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'

opichon avatar May 09 '21 04:05 opichon

CLA assistant check
All committers have signed the CLA.

strapi-cla avatar May 09 '21 04:05 strapi-cla