FROM php:8.1-fpm LABEL authors="misterzym" # Set working directory WORKDIR /var/www # Install dependencies RUN apt-get update && apt-get install -y \ build-essential \ libonig-dev \ libpng-dev \ libjpeg-dev \ libwebp-dev \ libfreetype6-dev \ libzip-dev \ locales \ zip \ unzip \ git \ curl && apt-get clean && rm -rf /var/lib/apt/lists/* # Install extensions RUN docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \ && docker-php-ext-install gd mbstring zip exif pcntl # Add user for laravel application RUN groupadd -g 1000 www RUN useradd -u 1000 -ms /bin/bash -g www www # Change current user to www RUN mkdir /etc/composer \ && cd /etc/composer \ && curl -O https://getcomposer.org/installer \ && ls -l \ && php ./installer --filename=composer --verion=${COMPOSER_VERSION} --install-dir=/bin \ && rm /etc/composer/installer \ && chmod a+x /bin/composer COPY ./ /var/www RUN cp -u /var/www/.env.example /var/www/.env RUN composer install --no-interaction --no-scripts --no-suggest RUN chmod 775 -R /var/www \ && chown www:www -R /var/www # Generate new key APP RUN php artisan key:generate USER www # Expose port 9000 and start php-fpm server EXPOSE 9000 CMD ["php-fpm"]