version: "3.9"
services:
  app:
    build: ./infra/php
    volumes:
      - ./backend:/work

  web:
    image: nginx:1.20-alpine
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./backend:/work
      - /etc/letsencrypt/live/kikikan.xyz:/etc/letsencrypt/live/kikikan.xyz
      - /etc/letsencrypt/archive/kikikan.xyz:/etc/letsencrypt/archive/kikikan.xyz
      # 本番環境
      # - ./infra/nginx/default.conf:/etc/nginx/conf.d/default.conf
      # 開発環境
      - ./infra/nginx/default.dev.conf:/etc/nginx/conf.d/default.conf
    working_dir: /work

  certbot:
    image: certbot/certbot:v1.7.0
    volumes:
      - ./backend:/work
      - /etc/letsencrypt:/etc/letsencrypt
    command: ["--version"]

  db:
    build: ./infra/mysql
    volumes:
      - db-store:/var/lib/mysql

volumes:
  db-store: