Skip to content

Instantly share code, notes, and snippets.

@asterion
Created December 31, 2024 14:34
Show Gist options
  • Save asterion/f54ebe30ec3ef3bdb87c623bd1757c46 to your computer and use it in GitHub Desktop.
Save asterion/f54ebe30ec3ef3bdb87c623bd1757c46 to your computer and use it in GitHub Desktop.
Dockerfile Laravel PHP 8.1
# Usar la imagen base de PHP 8.1 con FPM
FROM php:8.1-fpm
# Instalar extensiones y dependencias necesarias
RUN apt-get update && apt-get install -y \
libzip-dev \
unzip \
git \
libonig-dev \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libpq-dev \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& pecl install redis \
&& docker-php-ext-enable redis \
&& docker-php-ext-install \
pdo_mysql \
pdo_pgsql \
zip \
gd \
pcntl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Instalar Composer
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
# Configurar el directorio de trabajo
WORKDIR /var/www/html
# Ajustar permisos
RUN chown -R www-data:www-data /var/www/html \
&& chmod -R 755 /var/www/html
# Variables de entorno para PHP
ENV APP_ENV=local
ENV APP_DEBUG=true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment