--- # version: '3' # This is a bare minimum docker compose for you to use if the # env variable heavy one doesn't suit you. # In order to set configuration, please use a .env.docker # file in your compose project directory (the same directory # as your docker-compose.yml), and set database options, # application name, key, and other settings there. # Please note that this docker compose ignore all `DOCKER_` # variables. # A list of available settings is available in .env.example # # The services should scale properly across a swarm cluster # if the volumes are properly shared between cluster members. services: ## App, Worker and Cron web: image: ghcr.io/pixelfed-glitch/pixelfed:latest restart: unless-stopped env_file: - .env volumes: - ./data:/var/www/storage - ./cache:/var/www/bootstrap/cache - "./.env:/var/www/.env" ports: - "8080:80" environment: # Used by Pixelfed Docker init script DOCKER_SERVICE_NAME: "web" ENTRYPOINT_SKIP_SCRIPTS: ${ENTRYPOINT_SKIP_SCRIPTS:-} depends_on: - db - redis healthcheck: test: 'curl --fail http://localhost/api/service/health-check' interval: 10s timeout: 5s retries: 2 worker: image: ghcr.io/pixelfed-glitch/pixelfed:fpm-latest command: gosu www-data php artisan horizon restart: unless-stopped env_file: - .env volumes: - ./data:/var/www/storage - ./cache:/var/www/bootstrap/cache - "./.env:/var/www/.env" environment: # Used by Pixelfed Docker init script DOCKER_SERVICE_NAME: "worker" ENTRYPOINT_SKIP_SCRIPTS: any depends_on: - db - redis healthcheck: test: gosu www-data php artisan horizon:status | grep running interval: 10s timeout: 5s retries: 2 cron: image: ghcr.io/pixelfed-glitch/pixelfed:fpm-latest command: gosu www-data php artisan schedule:work -vvv restart: unless-stopped stop_signal: SIGTERM env_file: - .env volumes: - ./data:/var/www/storage - ./cache:/var/www/bootstrap/cache - "./.env:/var/www/.env" environment: # Used by Pixelfed Docker init script DOCKER_SERVICE_NAME: "cron" ENTRYPOINT_SKIP_SCRIPTS: any depends_on: - db - redis healthcheck: test: ps aux | egrep 'php artisan [s]chedule:work -vvv' interval: 10s timeout: 5s retries: 2 ## DB and Cache db: image: mariadb:lts command: --default-authentication-plugin=mysql_native_password restart: unless-stopped healthcheck: test: ["CMD", "healthcheck.sh", "--connect"] interval: 10s timeout: 5s retries: 2 environment: TZ: "${TZ:?error}" MARIADB_ROOT_PASSWORD: "${DOCKER_DB_ROOT_PASSWORD:?error}" MARIADB_USER: "${DB_USERNAME:?error}" MARIADB_PASSWORD: "${DB_PASSWORD:?error}" MARIADB_DATABASE: "${DB_DATABASE:?error}" volumes: - "./db:/var/lib/mysql" redis: image: redis:7.4-alpine command: " --requirepass '${REDIS_PASSWORD:-}'" restart: unless-stopped environment: TZ: "${TZ:?error}" REDISCLI_AUTH: ${REDIS_PASSWORD:-} healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 2 volumes: - "./redis:/data"