52 lines
1.2 KiB
Docker
52 lines
1.2 KiB
Docker
FROM --platform=linux/arm64 php:8.3-cli
|
|
|
|
|
|
# Install system dependencies & PHP extensions
|
|
RUN apt-get update && apt-get install -y \
|
|
libzip-dev \
|
|
unzip \
|
|
git \
|
|
libpq-dev \
|
|
libicu-dev \
|
|
zip \
|
|
curl \
|
|
&& docker-php-ext-install \
|
|
intl \
|
|
zip \
|
|
pdo_pgsql \
|
|
bcmath
|
|
|
|
# Install Composer
|
|
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
|
|
|
|
# Set working directory
|
|
WORKDIR /var/www
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
COPY .env.example .env
|
|
|
|
# Set permissions for Laravel writable directories
|
|
RUN mkdir -p storage bootstrap/cache \
|
|
&& chown -R www-data:www-data /var/www \
|
|
&& chmod -R ug+rwx storage bootstrap/cache
|
|
|
|
# Use non-root user for installing dependencies
|
|
USER www-data
|
|
|
|
# Install PHP dependencies
|
|
RUN composer install --no-interaction --prefer-dist --optimize-autoloader
|
|
|
|
# Back to root to ensure runtime permissions
|
|
USER root
|
|
|
|
# Re-apply permissions to writable folders
|
|
RUN chown -R www-data:www-data /var/www/storage /var/www/bootstrap/cache \
|
|
&& chmod -R 775 /var/www/storage /var/www/bootstrap/cache
|
|
|
|
# Expose Laravel development server port
|
|
EXPOSE 8000
|
|
|
|
# Run with artisan serve instead of php-fpm
|
|
CMD ["php", "artisan", "serve", "--host=0.0.0.0", "--port=8000"]
|