Skip to content

Instantly share code, notes, and snippets.

@sysatom
Created April 24, 2019 08:15
Show Gist options
  • Save sysatom/074729c47448b27322713e332686a39f to your computer and use it in GitHub Desktop.
Save sysatom/074729c47448b27322713e332686a39f to your computer and use it in GitHub Desktop.
Dockerfile of Laravel
FROM php:7.1-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 \
g++ \
gcc \
git \
imagemagick \
libc-dev \
libpng-dev \
make \
mysql-client \
nodejs \
nodejs-npm \
yarn \
openssh-client \
postgresql-libs \
rsync \
zlib-dev \
libzip-dev
# Install PECL and PEAR extensions
RUN pecl install \
imagick \
xdebug
# Install and enable php extensions
RUN docker-php-ext-enable \
imagick \
xdebug
RUN docker-php-ext-configure zip --with-libzip
RUN docker-php-ext-install \
curl \
iconv \
mbstring \
pdo \
pdo_mysql \
pdo_pgsql \
pdo_sqlite \
pcntl \
tokenizer \
xml \
gd \
zip \
bcmath
# 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
# Cleanup dev dependencies
RUN apk del -f .build-deps
# Setup working directory
WORKDIR /var/www
# Expose
CMD php artisan serve --host=0.0.0.0 --port=8080
EXPOSE 8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment