Created
June 3, 2025 17:37
-
-
Save wesllycode/b6f3f1fb8ad87ae2cfab96c7d54d4166 to your computer and use it in GitHub Desktop.
Peguei esse arquivo dockerfile para PHP 8.4 e APACHE como exemplo https://github.com/techgonia-devjio/php-contenv/blob/main/8.4/apache/Dockerfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM php:8.4-apache | |
LABEL maintainer="mani" | |
ARG NODE_VERSION=lts | |
ARG WWWUSER=1000 | |
ARG WWWGROUP=1000 | |
ENV NVM_DIR /usr/local/nvm | |
ENV NODE_VERSION=${NODE_VERSION} | |
ENV PATH $NVM_DIR/versions/node/v${NODE_VERSION}/bin:$PATH | |
WORKDIR /var/www/html | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
apt-transport-https \ | |
ca-certificates \ | |
curl \ | |
gnupg \ | |
gosu \ | |
zip \ | |
unzip \ | |
git \ | |
supervisor \ | |
sqlite3 \ | |
libcap2-bin \ | |
python3 \ | |
dnsutils \ | |
fswatch \ | |
ffmpeg \ | |
nano \ | |
libpq-dev \ | |
libzip-dev \ | |
libonig-dev \ | |
libxml2-dev \ | |
libssl-dev \ | |
pkg-config \ | |
libldap2-dev \ | |
libmemcached-dev \ | |
libcurl4-openssl-dev \ | |
libevent-dev \ | |
zlib1g-dev \ | |
libicu-dev \ | |
libmcrypt-dev \ | |
libreadline-dev \ | |
default-mysql-client \ | |
postgresql-client-15 \ | |
inkscape \ | |
# Image processing libraries | |
libpng-dev \ | |
libjpeg-dev \ | |
libfreetype6-dev \ | |
libmagickwand-dev \ | |
libvips-dev \ | |
&& apt-get clean \ | |
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | |
RUN a2enmod rewrite headers proxy proxy_fcgi setenvif | |
RUN docker-php-ext-configure gd --with-freetype --with-jpeg | |
RUN docker-php-ext-install pdo_mysql pdo_pgsql mysqli zip exif pcntl bcmath gd soap intl opcache | |
RUN curl -L -o /tmp/imagick.tar.gz https://github.com/Imagick/imagick/archive/7088edc353f53c4bc644573a79cdcd67a726ae16.tar.gz \ | |
&& tar --strip-components=1 -xf /tmp/imagick.tar.gz \ | |
&& phpize \ | |
&& ./configure \ | |
&& make \ | |
&& make install \ | |
&& echo "extension=imagick.so" > /usr/local/etc/php/conf.d/ext-imagick.ini \ | |
&& rm -rf /tmp/* | |
# Install vips extension for libvips (an other image library but faster) | |
RUN pecl install vips \ | |
&& docker-php-ext-enable vips | |
RUN pecl install xdebug redis memcached mongodb \ | |
&& docker-php-ext-enable xdebug redis imagick memcached mongodb | |
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer | |
RUN mkdir -p $NVM_DIR \ | |
&& chown -R www-data:www-data $NVM_DIR | |
# Install nvm with node and npm | |
COPY common/install-nvm.sh /tmp/install-nvm.sh | |
RUN chmod +x /tmp/install-nvm.sh | |
RUN /tmp/install-nvm.sh | |
RUN rm /tmp/install-nvm.sh && . $NVM_DIR/nvm.sh \ | |
&& nvm install ${NODE_VERSION} \ | |
&& nvm alias default ${NODE_VERSION} \ | |
&& nvm use default | |
ENV NODE_PATH $NVM_DIR/versions/node/$NODE_VERSION/bin | |
ENV PATH $NODE_PATH:$PATH | |
COPY common/apache-conf/apache2.conf /etc/apache2/apache2.conf | |
COPY common/apache-conf/default.conf /etc/apache2/sites-available/000-default.conf | |
RUN rm -f /var/www/html/index.html | |
COPY common/supervisord.apache.conf /etc/supervisor/conf.d/supervisord.conf | |
COPY common/php/php.ini /usr/local/etc/php/conf.d/php.ini | |
COPY common/php/20-xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini | |
COPY common/start-container /usr/local/bin/start-container | |
RUN chmod +x /usr/local/bin/start-container | |
RUN chown -R www-data:www-data /var/www/html | |
RUN mkdir -p /var/log/php /var/log/apache2 /var/log/supervisor | |
RUN chown -R www-data:www-data /var/log/php /var/log/apache2 /var/log/supervisor | |
EXPOSE 80 | |
ENTRYPOINT ["start-container"] | |
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment