Newer
Older
LaravelSample / docker-compose.yml
Shinya Tomozumi on 20 May 1 KB エラー対応のため修正する
services:
  # PHP Service
  web_app:
    container_name: web_app
    build:
      context: .
      dockerfile: .docker/web/php/Dockerfile
    depends_on:
      - database
    volumes:
      - ./src/:/app/
      - ./.docker/logs/web/php:/var/log/php
  # Nginx Service
  web_nginx:
    container_name: web-nginx
    build:
      context: .
      dockerfile: .docker/web/nginx/Dockerfile
    depends_on:
      - database
    volumes:
      - ./src/:/app/
      - ./.docker/logs/web/nginx:/var/log/nginx

  # Database Service
  database:
    image: postgres:17.5-alpine3.21
    container_name: database
    ports:
      - "5432:5432"
    restart: unless-stopped
    environment:
      POSTGRES_DB: sample-db
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: testpassword
    volumes:
      - ./.docker/db_data:/var/lib/postgresql/data
      - ./.docker/logs/db:/var/log/postgresql
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
      interval: 5s
      timeout: 5s
      retries: 5

volumes:
  db-volumes: