Skip to content

Instantly share code, notes, and snippets.

@warlock
Created June 3, 2020 12:48
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save warlock/05903be7bdb57aa7eb59920709cb9510 to your computer and use it in GitHub Desktop.
Save warlock/05903be7bdb57aa7eb59920709cb9510 to your computer and use it in GitHub Desktop.
Laravel PHP 7.4 Alpine Dockerfile
FROM php:7.4-alpine
# Install dev dependencies
RUN apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
curl-dev \
imagemagick-dev \
libtool \
libxml2-dev \
postgresql-dev \
sqlite-dev
# Install production dependencies
RUN apk add --no-cache \
bash \
curl \
freetype-dev \
g++ \
gcc \
git \
icu-dev \
icu-libs \
imagemagick \
libc-dev \
libjpeg-turbo-dev \
libpng-dev \
libzip-dev \
make \
mysql-client \
nodejs \
nodejs-npm \
oniguruma-dev \
yarn \
openssh-client \
postgresql-libs \
rsync \
zlib-dev
# Install PECL and PEAR extensions
RUN pecl install \
imagick \
xdebug
# Enable PECL and PEAR extensions
RUN docker-php-ext-enable \
imagick \
xdebug
# Configure php extensions
RUN docker-php-ext-configure gd --with-freetype --with-jpeg
# Install php extensions
RUN docker-php-ext-install \
bcmath \
calendar \
curl \
exif \
gd \
iconv \
intl \
mbstring \
pdo \
pdo_mysql \
pdo_pgsql \
pdo_sqlite \
pcntl \
tokenizer \
xml \
zip
# Install composer
ENV COMPOSER_HOME /composer
ENV PATH ./vendor/bin:/composer/vendor/bin:$PATH
ENV COMPOSER_ALLOW_SUPERUSER 1
RUN curl -s https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer
# Install PHP_CodeSniffer
RUN composer global require "squizlabs/php_codesniffer=*"
# Cleanup dev dependencies
RUN apk del -f .build-deps
# Setup working directory
WORKDIR /var/www
COPY . /var/www
RUN composer install
# Setup working directory
CMD php artisan serve --host=0.0.0.0 --port=8181
EXPOSE 8181
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment