Skip to content

Instantly share code, notes, and snippets.

@rogervila
Created June 23, 2021 09:13
Show Gist options
  • Save rogervila/cb784cc7a661ab958203dc963048d219 to your computer and use it in GitHub Desktop.
Save rogervila/cb784cc7a661ab958203dc963048d219 to your computer and use it in GitHub Desktop.
Laravel Dockerfile
version: "3.8"
services:
web:
build:
context: .
restart: always
ports:
- "8888:80"
FROM php:8.0-apache
WORKDIR /var/www
ENV DEBIAN_FRONTEND noninteractive
ENV APACHE_DOCUMENT_ROOT="/var/www/public"
RUN \
apt-get update -y && \
apt-get install -y --no-install-recommends curl git zip unzip libzip-dev && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf && \
sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf && \
a2enmod rewrite && \
docker-php-ext-install zip && \
curl https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
ADD composer.json composer.json
ADD composer.lock composer.lock
RUN \
composer install --no-dev --no-progress --no-scripts --no-autoloader --working-dir "/var/www/"
ADD . .
RUN \
composer dump-autoload
EXPOSE 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment