Files
knowledge_base/docker/php/Dockerfile
2025-11-29 15:54:35 +09:00

37 lines
892 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
FROM php:8.3-fpm
# 必要なパッケージのインストール
RUN apt-get update && apt-get install -y \
git \
curl \
libpng-dev \
libonig-dev \
libxml2-dev \
libzip-dev \
zip \
unzip \
&& docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd zip
# Composerのインストール
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Node.jsとnpmのインストールLaravel Mixやvite用
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs
# 作業ディレクトリの設定
WORKDIR /var/www/html
# パーミッション設定
RUN chown -R www-data:www-data /var/www/html \
&& chmod -R 755 /var/www/html
# クリーンアップ
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# ユーザーをwww-dataに切り替え
USER www-data
# PHP-FPMを実行
CMD ["php-fpm"]