Создаём фаил docker-compose.yml и добавляем в него содержимое
version: '3'
services:
strapi-app:
container_name: strapi-app
image: strapi/strapi
restart: unless-stopped
environment:
- DATABASE_CLIENT=postgres
- DATABASE_HOST=strapi-postgres
- DATABASE_PORT=5432
- DATABASE_NAME=strapi
- DATABASE_USERNAME=strapi
- DATABASE_PASSWORD=StrApiPassw0rd
ports:
- 1337:1337
volumes:
- ./app:/srv/app
depends_on:
- strapi-postgres
# labels:
# - traefik.enable=true
# - traefik.http.middlewares.strapi-app_https.redirectscheme.scheme=https
# - traefik.http.routers.strapi-app.entrypoints=web
# - traefik.http.routers.strapi-app.middlewares=strapi-app_https@docker
# - traefik.http.routers.strapi-app.rule=Host(`strapi.{yourdomain}`)
# - traefik.http.routers.strapi-app_https.entrypoints=websecure
# - traefik.http.routers.strapi-app_https.rule=Host(`strapi.{yourdomain}`)
# - traefik.http.services.strapi-app.loadbalancer.server.port=1337
# - traefik.http.routers.strapi-app_https.tls=true
# - traefik.http.routers.strapi-app_https.tls.certresolver=le
strapi-postgres:
container_name: strapi-postgres
image: postgres
restart: unless-stopped
volumes:
- ./data:/var/lib/postgresql/data
environment:
POSTGRES_USER: strapi
POSTGRES_PASSWORD: StrApiPassw0rd
POSTGRES_DB: strapi
networks:
default:
external:
name: traefik_network
если планируется работа через traefik раскомментируйте блок labels и замените {yourdomain} на свой домен