Files
kulakpos_web/Dockerfile

86 lines
2.3 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-29 15:33:07 +07:00
# Configure git to allow safe directory
RUN git config --global --add safe.directory /var/www/html
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 19:35:21 +07:00
# Copy ONLY composer files first
COPY composer.json composer.lock ./
2026-03-29 15:33:07 +07:00
2026-03-29 19:35:21 +07:00
# Create storage and bootstrap directories needed for composer scripts
2026-03-29 15:42:51 +07:00
RUN mkdir -p storage/framework/cache \
&& mkdir -p storage/framework/sessions \
&& mkdir -p storage/framework/views \
&& mkdir -p storage/framework/testing \
2026-03-29 14:45:23 +07:00
&& mkdir -p storage/logs \
&& mkdir -p bootstrap/cache \
&& chmod -R 777 storage \
&& chmod -R 777 bootstrap/cache
2026-03-29 14:37:23 +07:00
2026-03-29 19:35:21 +07:00
# Install PHP dependencies (this layer will be cached)
RUN composer install --no-interaction --no-progress --no-scripts
# Isolate the clean vendor directory
RUN mv vendor /vendor_clean
2026-03-29 15:42:51 +07:00
2026-03-29 19:35:21 +07:00
# Copy the rest of the application files (will ignore vendor because of .dockerignore)
COPY --chown=www-data:www-data . .
2026-03-29 15:42:51 +07:00
2026-03-30 14:18:41 +07:00
# Restore the clean vendor directory and set proper permissions
RUN rm -rf vendor && mv /vendor_clean vendor && chown -R www-data:www-data vendor
2026-03-29 14:53:39 +07:00
2026-03-29 19:35:21 +07:00
# Final build verification
RUN if [ ! -f vendor/laravel/prompts/src/helpers.php ]; then \
echo "ERROR: laravel/prompts/src/helpers.php missing!" && exit 1; \
2026-03-29 15:12:24 +07:00
fi
2026-03-29 19:35:21 +07:00
# Final check and debug listing
RUN ls -l vendor/laravel/prompts/src/helpers.php \
&& du -sh vendor/laravel/prompts
2026-03-29 14:32:03 +07:00
# 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:32:03 +07:00
# Build Vite assets
2026-03-29 19:35:21 +07:00
RUN npm run build
2026-03-29 14:53:39 +07:00
2026-03-29 19:35:21 +07:00
# Copy entrypoint script and ensure it's executable
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
2026-03-29 19:35:21 +07:00
# Let the entrypoint handle artisan commands at runtime
2026-03-16 04:20:00 +07:00
EXPOSE 8000 9000
2026-03-16 10:20:15 +07:00
ENTRYPOINT ["/entrypoint.sh"]