Skip to content

Instantly share code, notes, and snippets.

@mi2ku39
Last active November 5, 2022 00:54
Show Gist options
  • Save mi2ku39/091a90a51aad2df413d815e91e71a5d0 to your computer and use it in GitHub Desktop.
Save mi2ku39/091a90a51aad2df413d815e91e71a5d0 to your computer and use it in GitHub Desktop.
Laravel Dockerfile
<VirtualHost *:80>
DocumentRoot /var/www/app/public
<Directory "/var/www/app/public">
AllowOverride All
</Directory>
</VirtualHost>
FROM composer:latest AS composer
FROM node:lts-slim AS node
FROM php:8-apache
# multi stage building composer
COPY --from=composer /usr/bin/composer /usr/bin/composer
# multi stage building node
COPY --from=node /opt/ /opt/
COPY --from=node /usr/local/lib/ /usr/local/lib/
COPY --from=node /usr/local/bin/ /usr/local/bin/
# nodejs needs g++
# laravel/installer needs libzip-dev
# pdo-pgsql needs libpq-dev
RUN apt update && apt upgrade -y && apt install -y g++ vim libzip-dev libpq-dev
RUN docker-php-ext-install zip pdo_pgsql
# install laravel/installer
RUN composer global require "laravel/installer"
ENV PATH $PATH:/root/.composer/vendor/bin
# copy configuration files
COPY php.ini /usr/local/etc/php/
COPY apache.conf /etc/apache2/sites-enabled/000-default.conf
# enable apache configurations
RUN a2enmod rewrite
upload_max_filesize = 120M
post_max_size = 120M
[Date]
date.timezone = "Asia/Tokyo"
[mbstring]
mbstring.language = "Japanese"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment