feat: fix dockerfile
This commit is contained in:
+95
-12
@@ -1,17 +1,78 @@
|
||||
name: bemeal
|
||||
name: daily-meal-api
|
||||
|
||||
x-app-image: &app-image git.leonmorival.xyz/leonm/daily-meal-api:${IMAGE_TAG:-latest}
|
||||
|
||||
x-app-environment: &app-environment
|
||||
APP_ENV: production
|
||||
APP_DEBUG: "false"
|
||||
APP_RUNTIME: "Laravel\\FrankenPHP\\Runtime"
|
||||
SERVER_NAME: ":80"
|
||||
DB_CONNECTION: pgsql
|
||||
DB_HOST: postgres
|
||||
DB_PORT: "5432"
|
||||
REDIS_HOST: redis
|
||||
REDIS_CLIENT: predis
|
||||
QUEUE_CONNECTION: redis
|
||||
SCOUT_DRIVER: meilisearch
|
||||
MEILISEARCH_HOST: http://meilisearch:7700
|
||||
|
||||
x-app-volumes: &app-volumes
|
||||
- storage-data:/var/www/html/storage/app
|
||||
- storage-public-data:/var/www/html/storage/app/public
|
||||
|
||||
x-app-service: &app-service
|
||||
image: *app-image
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- .env
|
||||
environment: *app-environment
|
||||
volumes: *app-volumes
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_started
|
||||
meilisearch:
|
||||
condition: service_started
|
||||
networks:
|
||||
- internal
|
||||
|
||||
services:
|
||||
pgsql:
|
||||
app:
|
||||
<<: *app-service
|
||||
container_name: daily-meal-api
|
||||
networks:
|
||||
- proxy
|
||||
- internal
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1/api/health >/dev/null 2>&1"]
|
||||
start_period: 30s
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 12
|
||||
|
||||
horizon:
|
||||
<<: *app-service
|
||||
container_name: daily-meal-api-horizon
|
||||
command: ["php", "artisan", "horizon"]
|
||||
|
||||
scheduler:
|
||||
<<: *app-service
|
||||
container_name: daily-meal-api-scheduler
|
||||
command: ["php", "artisan", "schedule:work"]
|
||||
|
||||
postgres:
|
||||
image: postgres:15-alpine
|
||||
container_name: bemeal-pgsql
|
||||
container_name: daily-meal-api-postgres
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: "${DB_DATABASE:?DB_DATABASE is required}"
|
||||
POSTGRES_USER: "${DB_USERNAME:?DB_USERNAME is required}"
|
||||
POSTGRES_PASSWORD: "${DB_PASSWORD:?DB_PASSWORD is required}"
|
||||
volumes:
|
||||
- pgsql-data:/var/lib/postgresql/data
|
||||
- postgres-data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -h 127.0.0.1 -p 5432"]
|
||||
test: ["CMD-SHELL", "pg_isready -h 127.0.0.1 -p 5432 -U $$POSTGRES_USER -d $$POSTGRES_DB"]
|
||||
start_period: 30s
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
@@ -21,36 +82,58 @@ services:
|
||||
|
||||
redis:
|
||||
image: redis:alpine
|
||||
container_name: bemeal-redis
|
||||
container_name: daily-meal-api-redis
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- redis-data:/data
|
||||
networks:
|
||||
- internal
|
||||
|
||||
meilisearch:
|
||||
image: getmeili/meilisearch:latest
|
||||
container_name: daily-meal-api-meilisearch
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MEILI_NO_ANALYTICS: "true"
|
||||
MEILI_MASTER_KEY: "${MEILISEARCH_KEY:?MEILISEARCH_KEY is required}"
|
||||
volumes:
|
||||
- meilisearch-data:/meili_data
|
||||
networks:
|
||||
- internal
|
||||
|
||||
adminer:
|
||||
image: adminer:latest
|
||||
container_name: bemeal-adminer
|
||||
container_name: daily-meal-api-adminer
|
||||
restart: unless-stopped
|
||||
profiles:
|
||||
- debug
|
||||
ports:
|
||||
- "127.0.0.1:${ADMINER_PORT:-8080}:8080"
|
||||
environment:
|
||||
ADMINER_DEFAULT_SERVER: bemeal-pgsql
|
||||
ADMINER_DEFAULT_SERVER: postgres
|
||||
networks:
|
||||
- internal
|
||||
|
||||
|
||||
volumes:
|
||||
pgsql-data:
|
||||
postgres-data:
|
||||
external: true
|
||||
name: bemeal_pgsql_data
|
||||
|
||||
redis-data:
|
||||
name: bemeal_redis_data
|
||||
|
||||
meilisearch-data:
|
||||
name: bemeal_meilisearch_data
|
||||
|
||||
storage-data:
|
||||
name: bemeal_storage_data
|
||||
|
||||
storage-public-data:
|
||||
name: bemeal_storage_public_data
|
||||
|
||||
networks:
|
||||
internal:
|
||||
proxy:
|
||||
external: true
|
||||
name: bemeal_internal
|
||||
|
||||
internal:
|
||||
driver: bridge
|
||||
|
||||
Reference in New Issue
Block a user