Files
kulakpos_web/Dockerfile
eko 74e6666da5
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 8s
Build, Push and Deploy / build-and-push (push) Successful in 2m39s
Build, Push and Deploy / deploy-staging (push) Successful in 22s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
fix docker
2026-03-29 15:42:51 +07:00

93 lines
2.4 KiB
Docker

FROM php:8.2-fpm-alpine
# Install system dependencies
RUN apk add --no-cache \
vim \
xxd \
libzip-dev \
postgresql-dev \
libpng-dev \
libjpeg-turbo-dev \
freetype-dev \
oniguruma-dev \
git \
curl \
nodejs \
npm \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) \
pdo_pgsql \
pgsql \
opcache \
zip \
bcmath \
gd \
exif \
pcntl
# Configure git to allow safe directory
RUN git config --global --add safe.directory /var/www/html
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
WORKDIR /var/www/html
# Copy ALL application files first
COPY --chown=www-data:www-data . .
# Remove any nested vendor directories
RUN find . -type d -name "vendor" -not -path "./vendor*" -exec rm -rf {} + 2>/dev/null || true
# Remove composer.lock to ensure fresh install
RUN rm -f composer.lock
# Create ALL storage directories BEFORE composer install
RUN mkdir -p storage/framework/cache \
&& mkdir -p storage/framework/sessions \
&& mkdir -p storage/framework/views \
&& mkdir -p storage/framework/testing \
&& mkdir -p storage/logs \
&& mkdir -p bootstrap/cache \
&& mkdir -p storage/framework/cache/data \
&& chmod -R 777 storage \
&& chmod -R 777 bootstrap/cache
# Create a temporary config file to avoid cache path issues during composer
RUN if [ ! -f config/app.php ]; then \
echo "<?php return ['providers' => []];" > config/app.php; \
fi
# Set environment variable for cache path
ENV VIEW_COMPILED_PATH=/var/www/html/storage/framework/views
# Install PHP dependencies
RUN composer install --no-interaction --no-progress --optimize-autoloader
# Verify critical files exist
RUN if [ ! -f vendor/laravel/framework/src/Illuminate/Foundation/resources/server.php ]; then \
echo "ERROR: server.php missing!" && exit 1; \
fi
# Copy package files for NPM
COPY package*.json ./
COPY vite.config.js ./
# Install NPM dependencies
RUN npm install --legacy-peer-deps --no-audit
# Build Vite assets
RUN npm run build || true
# Generate application key
RUN php artisan key:generate --no-interaction --force || true
# Cache configurations
RUN php artisan config:cache || true
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 8000 9000
ENTRYPOINT ["/entrypoint.sh"]