Files
growup-crm/Dockerfile
Cauê Faleiros cf394b6607
Some checks failed
Build and Deploy / build-and-deploy (push) Failing after 2m23s
Fix: Execute Vite build from package directories in Dockerfile
This resolves the 'Could not resolve entry module' error by ensuring Vite runs
within the context of each package, allowing relative paths in vite.config.js to resolve correctly.
2026-02-04 11:12:13 -03:00

52 lines
1.9 KiB
Docker

FROM php:8.2-apache
# 1. Dependências (Inclui netcat-openbsd e redis)
RUN apt-get update && apt-get install -y \
git curl unzip libpng-dev libonig-dev libxml2-dev libzip-dev libicu-dev zip vim nano autoconf pkg-config netcat-openbsd \
&& pecl install redis \
&& docker-php-ext-enable redis \
&& docker-php-ext-configure intl \
&& docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd zip calendar intl \
&& a2enmod rewrite \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
WORKDIR /var/www/html
COPY . .
# 2. Copia as correções manuais
# COPY AppServiceProvider.php app/Providers/AppServiceProvider.php
# COPY TrustProxies.php app/Http/Middleware/TrustProxies.php
COPY 000-default.conf /etc/apache2/sites-available/000-default.conf
# 3. Pastas e Permissões
RUN mkdir -p storage/framework/sessions \
&& mkdir -p storage/framework/views \
&& mkdir -p storage/framework/cache \
&& mkdir -p bootstrap/cache \
&& chown -R www-data:www-data /var/www/html/storage \
&& chown -R www-data:www-data /var/www/html/bootstrap/cache \
&& chmod -R 775 /var/www/html/storage
# 4. Instalação do PHP
RUN composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader
# 4.1. Instalação do Node.js e Build dos Assets
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
&& apt-get install -y nodejs \
&& npm install \
&& npm run build \
&& (cd packages/Webkul/Admin && npx vite build) \
&& (cd packages/Webkul/Installer && npx vite build) \
&& (cd packages/Webkul/WebForm && npx vite build) \
&& rm -rf node_modules
# 5. Script de Entrada
COPY docker-entrypoint.sh /usr/local/bin/
# Garante quebras de linha Linux
RUN sed -i 's/\r$//' /usr/local/bin/docker-entrypoint.sh
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
EXPOSE 80
ENTRYPOINT ["docker-entrypoint.sh"]