Files
kulakpos_web/Dockerfile

90 lines
2.0 KiB
Docker
Raw Normal View History

2026-03-16 04:20:00 +07:00
FROM php:8.2-fpm-alpine
2026-03-16 07:22:01 +07:00
# Install system dependencies
2026-03-16 04:20:00 +07:00
RUN apk add --no-cache \
2026-03-22 09:53:38 +07:00
vim \
2026-03-22 09:59:02 +07:00
xxd \
2026-03-16 04:20:00 +07:00
libzip-dev \
postgresql-dev \
2026-03-16 06:45:23 +07:00
libpng-dev \
libjpeg-turbo-dev \
freetype-dev \
oniguruma-dev \
2026-03-16 07:22:01 +07:00
git \
curl \
2026-03-29 13:48:35 +07:00
nodejs \
npm \
2026-03-16 06:45:23 +07:00
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
2026-03-16 04:20:00 +07:00
&& docker-php-ext-install -j$(nproc) \
pdo_pgsql \
pgsql \
opcache \
zip \
2026-03-16 06:45:23 +07:00
bcmath \
gd \
exif \
2026-03-16 07:22:01 +07:00
pcntl
2026-03-16 04:20:00 +07:00
2026-03-16 06:41:29 +07:00
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
2026-03-16 04:20:00 +07:00
WORKDIR /var/www/html
2026-03-29 14:32:03 +07:00
# Copy composer files first
COPY composer.json composer.lock ./
2026-03-29 14:37:23 +07:00
# Create missing Helper.php file before composer install
RUN mkdir -p app/Helpers && \
cat > app/Helpers/Helper.php << 'EOF'
<?php
namespace App\Helpers;
class Helper
{
// Add your helper functions here
public static function example()
{
return "Helper loaded";
}
}
EOF
# Install PHP dependencies
2026-03-29 14:32:03 +07:00
RUN composer install --no-interaction --no-progress --optimize-autoloader
# Copy package files for NPM
2026-03-29 13:48:35 +07:00
COPY package*.json ./
COPY vite.config.js ./
# Install NPM dependencies
2026-03-29 14:32:03 +07:00
RUN npm install --legacy-peer-deps --no-audit
2026-03-29 13:48:35 +07:00
2026-03-29 14:37:23 +07:00
# Copy application files (this will overwrite the placeholder Helper.php if exists)
2026-03-16 04:20:00 +07:00
COPY --chown=www-data:www-data . .
2026-03-23 11:36:51 +07:00
# Remove any nested vendor directories to avoid conflicts
RUN find . -type d -name "vendor" -not -path "./vendor*" -exec rm -rf {} + 2>/dev/null || true
# Create all necessary directories
2026-03-16 09:57:31 +07:00
RUN mkdir -p storage/framework/{cache,sessions,views} \
&& mkdir -p storage/logs \
&& mkdir -p bootstrap/cache \
2026-03-23 11:27:36 +07:00
&& chmod -R 777 storage \
&& chmod -R 777 bootstrap/cache
2026-03-16 09:57:31 +07:00
2026-03-29 14:32:03 +07:00
# Build Vite assets
2026-03-29 13:48:35 +07:00
RUN npm run build
2026-03-29 14:37:23 +07:00
# Run package discovery
2026-03-29 14:32:03 +07:00
RUN php artisan package:discover --ansi || true
2026-03-23 11:32:51 +07:00
2026-03-23 11:36:51 +07:00
# Generate application key
RUN php artisan key:generate --no-interaction --force || true
2026-03-16 09:57:31 +07:00
2026-03-16 10:20:15 +07:00
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
2026-03-16 04:20:00 +07:00
EXPOSE 8000 9000
2026-03-16 10:20:15 +07:00
ENTRYPOINT ["/entrypoint.sh"]