diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..8ae1045 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,28 @@ +node_modules +vendor +.git +.github +.env +.env.example +.editorconfig +.gitignore +.gitattributes +docker-compose.yml +.idea +.vscode +*.log +storage/logs/* +storage/framework/cache/* +storage/framework/sessions/* +storage/framework/views/* +bootstrap/cache/* +!storage/app/.gitignore +!storage/app/public/.gitignore +!storage/framework/cache/.gitignore +!storage/framework/sessions/.gitignore +!storage/framework/views/.gitignore +!bootstrap/cache/.gitignore +tests +phpunit.xml +.phpunit.result.cache +README.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..136b91e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,54 @@ +FROM php:8.4-fpm-alpine + +# Set working directory +WORKDIR /var/www/html + +# Install system dependencies +RUN apk add --no-cache \ + curl \ + libpng-dev \ + libzip-dev \ + zip \ + unzip \ + git \ + oniguruma-dev \ + sqlite \ + nodejs \ + npm + +# Install PHP extensions +RUN docker-php-ext-install pdo_mysql pdo_sqlite mbstring exif pcntl bcmath gd zip + +# Install Composer +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer + +# Copy application files +COPY . . + +# Install PHP dependencies +RUN composer install --no-dev --optimize-autoloader --no-interaction + +# Install Node dependencies and build assets +RUN npm ci && npm run build && rm -rf node_modules + +# Set permissions +RUN chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache && \ + chmod -R 775 /var/www/html/storage /var/www/html/bootstrap/cache + +# Create SQLite database if it doesn't exist +RUN touch /var/www/html/database/database.sqlite && \ + chown www-data:www-data /var/www/html/database/database.sqlite && \ + chmod 664 /var/www/html/database/database.sqlite + +# Switch to www-data user +USER www-data + +# Expose port +EXPOSE 8000 + +# Start the application +CMD php artisan config:cache && \ + php artisan route:cache && \ + php artisan view:cache && \ + php artisan migrate --force && \ + php artisan serve --host=0.0.0.0 --port=8000