Skip to content

Instantly share code, notes, and snippets.

@briceburg
Last active August 21, 2021 06:02
Show Gist options
  • Save briceburg/fd875a6e4e339fe48607 to your computer and use it in GitHub Desktop.
Save briceburg/fd875a6e4e339fe48607 to your computer and use it in GitHub Desktop.
laravel 5 - running in a docker container
---
app:
build: .
# optional, map host port 8000 to container port 80
ports:
- 8000:80
environment:
# vars available to app
VIRTUAL_HOST: laravelapp.com
FROM alpine
ENV \
APP_DIR="/app" \
APP_PORT="80"
# the "app" directory (relative to Dockerfile) containers your Laravel app...
COPY app/ $APP_DIR
RUN apk add --update \
curl \
php \
php-opcache \
php-openssl \
php-pdo \
php-json \
php-phar \
php-dom \
&& rm -rf /var/cache/apk/*
RUN curl -sS https://getcomposer.org/installer | php -- \
--install-dir=/usr/bin --filename=composer
RUN cd $APP_DIR && composer install
WORKDIR $APP_DIR
CMD php artisan serve --host=0.0.0.0 --port=$APP_PORT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment