Skip to content

Instantly share code, notes, and snippets.

@felixivance
Created September 23, 2022 06:24
Show Gist options
  • Save felixivance/1c00e3479a3ba9c1c1b2efa5e2b8eabc to your computer and use it in GitHub Desktop.
Save felixivance/1c00e3479a3ba9c1c1b2efa5e2b8eabc to your computer and use it in GitHub Desktop.
App Docker file Laravel setup
FROM php:7.4-fpm-alpine
RUN mkdir -p /var/www/html
WORKDIR /var/www/html
RUN sed -i "s/user = www-data/user = root/g" /usr/local/etc/php-fpm.d/www.conf
RUN sed -i "s/group = www-data/group = root/g" /usr/local/etc/php-fpm.d/www.conf
RUN echo "php_admin_flag[log_errors] = on" >> /usr/local/etc/php-fpm.d/www.conf
RUN apt-get update && apt-get install -y \
mysql-client --no-install-recommends \
&& zip unzip php7.4-zip php7.4-curl php7.4-gd php7.4-mbstring\
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
RUN docker-php-ext-install mysqli pdo_mysql && docker-php-ext-enable mysqli && docker-php-ext-enable pdo_mysql
# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- --version=2.3.9 --install-dir=/usr/local/bin --filename=composer
# Install git & nano, then remove temporary files
RUN apt-get update \
&& apt-get -y install git nano \
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
CMD ["php-fpm", "-y", "/usr/local/etc/php-fpm.conf", "-R"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment