Atualizar Dockerfile

This commit is contained in:
2025-06-12 12:42:55 +00:00
parent b1884dadc0
commit fca0a700ac

View File

@@ -1,28 +1,46 @@
FROM php:8.2-apache
# Imagem base com PHP, Apache e extensões necessárias
FROM php:8.1-apache
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
libzip-dev \
unzip \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libonig-dev; \
docker-php-ext-configure gd --with-freetype --with-jpeg; \
docker-php-ext-install pdo pdo_mysql mbstring zip gd; \
rm -rf /var/lib/apt/lists/*
# Configura o timezone
ENV TZ=America/Sao_Paulo
# Habilita módulos do Apache necessários
RUN a2enmod rewrite
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
COPY . /var/www/html
RUN chown -R www-data:www-data /var/www/html && chmod -R 755 /var/www/html
# Instala dependências do sistema
RUN apt-get update && apt-get install -y \
libicu-dev \
libzip-dev \
libjpeg-dev \
libpng-dev \
libfreetype6-dev \
unzip \
git \
zip \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install intl zip pdo pdo_mysqli mbstring gd \
&& apt-get clean
# Configura o diretório padrão do Apache
WORKDIR /var/www/html
RUN composer install --no-interaction --prefer-dist --optimize-autoloader
# Define o índice padrão do Apache
RUN echo "DirectoryIndex login.php index.php" > /etc/apache2/conf-available/directoryindex.conf && \
a2enconf directoryindex
# Copia os arquivos da aplicação empacotada
COPY app.zip /var/www/html/
RUN unzip -o app.zip && rm app.zip
# Copia e descompacta os arquivos auxiliares
#COPY files.zip /data/coolify/sgq/files/
#RUN cd /data/coolify/sgq/files && unzip -o files.zip && rm files.zip
# Ajusta permissões
RUN chown -R www-data:www-data /var/www/html
# Expõe a porta 80
EXPOSE 80
# Inicializa o Apache em foreground
CMD ["apache2-foreground"]