Docker(応用) - user000422/0 GitHub Wiki

Dockerfile(RHEL + PHP8.1 Laravelの下地)

FROM redhat/ubi9:latest

# Utility
RUN dnf -y install unzip

# Apache
RUN dnf -y install httpd

# PHP
RUN dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm \
&& dnf -y install https://rpms.remirepo.net/enterprise/remi-release-9.rpm \
&& dnf -y module install php:remi-8.1

# PHP module
RUN dnf -y install php-zip

# Composer
RUN curl -sS https://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/composer \
&& chmod +x /usr/local/bin/composer

# Edit httpd.conf
RUN sed -i 's/#ServerName www.example.com:80/ServerName localhost:80/g' /etc/httpd/conf/httpd.conf

WORKDIR /

MySQL

version: '3'

services:
  db:
    image: mysql
    restart: always

    # 環境変数
    environment:
      MYSQL_PASSWORD: password
      MYSQL_ROOT_PASSWORD: password  # root用パスワード ※なぜか必須
    ports:
      - "3306:3306"