feat: docker docmpose

This commit is contained in:
2026-05-19 15:52:29 +02:00
parent dadd4e04b1
commit e984ec04b5
2 changed files with 74 additions and 81 deletions
+48 -23
View File
@@ -1,7 +1,13 @@
name: bemeal
# =========================
# IMAGE
# =========================
x-app-image: &app-image gitea.leonmorival.com/daily_meal/bemeal-api:${IMAGE_TAG:-latest}
# =========================
# ENV
# =========================
x-app-environment: &app-environment
APP_LOCALE: "fr"
APP_ENV: "production"
@@ -14,33 +20,30 @@ x-app-environment: &app-environment
FILESYSTEM_DISK: "public"
DB_CONNECTION: "pgsql"
DB_HOST: "pgsql"
DB_HOST: "bemeal-pgsql"
DB_PORT: "5432"
DB_DATABASE: "${DB_DATABASE:?DB_DATABASE is required}"
DB_USERNAME: "${DB_USERNAME:?DB_USERNAME is required}"
DB_PASSWORD: "${DB_PASSWORD:?DB_PASSWORD is required}"
GEMINI_API_KEY: "${GEMINI_API_KEY:?GEMINI_API_KEY is required}"
AI_MEAL_USER_NAME: "${AI_MEAL_USER_NAME:-Lolo AI}"
AI_MEAL_USER_EMAIL: "${AI_MEAL_USER_EMAIL:-loloai@maily.com}"
AI_MEAL_IMAGE_PATH: "${AI_MEAL_IMAGE_PATH:-meal-posts/ai-generated}"
AI_MEAL_IMAGE_QUALITY: "${AI_MEAL_IMAGE_QUALITY:-medium}"
AI_MEAL_TEXT_TIMEOUT: "${AI_MEAL_TEXT_TIMEOUT:-90}"
AI_MEAL_IMAGE_TIMEOUT: "${AI_MEAL_IMAGE_TIMEOUT:-120}"
REDIS_HOST: "redis"
REDIS_HOST: "bemeal-redis"
REDIS_CLIENT: "predis"
QUEUE_CONNECTION: "redis"
SCOUT_DRIVER: "meilisearch"
MEILISEARCH_HOST: "http://meilisearch:7700"
MEILISEARCH_HOST: "http://bemeal-meilisearch:7700"
MEILISEARCH_KEY: "${MEILISEARCH_KEY:?MEILISEARCH_KEY is required}"
# =========================
# VOLUMES
# =========================
x-app-volumes: &app-volumes
- storage-data:/var/www/html/storage/app
- storage-public-data:/var/www/html/storage/app/public
# =========================
# DEPENDS
# =========================
x-app-depends-on: &app-depends-on
pgsql:
condition: service_healthy
@@ -49,6 +52,9 @@ x-app-depends-on: &app-depends-on
meilisearch:
condition: service_started
# =========================
# HEALTHCHECK
# =========================
x-app-healthcheck: &app-healthcheck
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1/api/health >/dev/null 2>&1"]
start_period: 30s
@@ -56,6 +62,9 @@ x-app-healthcheck: &app-healthcheck
timeout: 5s
retries: 12
# =========================
# APP BASE
# =========================
x-app-service: &app-service
image: *app-image
restart: unless-stopped
@@ -67,7 +76,11 @@ x-app-service: &app-service
- public
stop_grace_period: 30s
# =========================
# SERVICES
# =========================
services:
# =========================
# BLUE
# =========================
@@ -75,10 +88,6 @@ services:
<<: *app-service
container_name: bemeal-api-blue
healthcheck: *app-healthcheck
networks:
public:
aliases:
- bemeal-app
# =========================
# GREEN
@@ -87,10 +96,6 @@ services:
<<: *app-service
container_name: bemeal-api-green
healthcheck: *app-healthcheck
networks:
public:
aliases:
- bemeal-app
# =========================
# DATABASE
@@ -114,6 +119,9 @@ services:
networks:
- internal
# =========================
# REDIS
# =========================
redis:
image: redis:alpine
container_name: bemeal-redis
@@ -123,6 +131,9 @@ services:
networks:
- internal
# =========================
# HORIZON
# =========================
horizon:
image: *app-image
container_name: bemeal-horizon
@@ -134,10 +145,13 @@ services:
condition: service_started
environment: *app-environment
volumes: *app-volumes
command: "php artisan horizon"
command: php artisan horizon
networks:
- internal
# =========================
# SCHEDULER
# =========================
scheduler:
image: *app-image
container_name: bemeal-scheduler
@@ -149,19 +163,25 @@ services:
condition: service_started
environment: *app-environment
volumes: *app-volumes
command: "php artisan schedule:work"
command: php artisan schedule:work
networks:
- internal
# =========================
# ADMINER
# =========================
adminer:
image: adminer:latest
container_name: bemeal-adminer
restart: unless-stopped
environment:
ADMINER_DEFAULT_SERVER: pgsql
ADMINER_DEFAULT_SERVER: bemeal-pgsql
networks:
- internal
# =========================
# MEILISEARCH
# =========================
meilisearch:
image: getmeili/meilisearch:latest
container_name: bemeal-meilisearch
@@ -181,12 +201,16 @@ volumes:
pgsql-data:
external: true
name: bemeal_pgsql_data
redis-data:
name: bemeal_redis_data
storage-data:
name: bemeal_storage_data
storage-public-data:
name: bemeal_storage_public_data
meilisearch-data:
name: bemeal_meilisearch_data
@@ -195,6 +219,7 @@ volumes:
# =========================
networks:
internal:
name: bemeal_internal
driver: bridge
public: