FROM php:7.4-fpm

# 必要な拡張機能をインストール
RUN apt-get update && apt-get install -y \
    libpng-dev \
    libjpeg-dev \
    libfreetype6-dev \
    libonig-dev \
    libxml2-dev \
    zip \
    unzip \
    git \
    curl \
    nginx \
    supervisor \
    && docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd

# Nginx設定ファイルのコピー
COPY ./nginx.conf /etc/nginx/nginx.conf

# Supervisor設定ファイルを追加
COPY ./supervisord.conf /etc/supervisor/conf.d/supervisord.conf

# Composerをインストール
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

# Laravelの作業ディレクトリを設定
WORKDIR /var/www/html

# Supervisorを使ってNginxとPHP-FPMを起動
CMD ["/usr/bin/supervisord"]
