build(docker): enhance Docker setup with proper dependencies and structure
- Add comprehensive .dockerignore file to exclude unnecessary files - Update Dockerfile to install required system dependencies and PHP extensions - Set proper working directory and user permissions - Use multi-stage build for Composer installation
This commit is contained in:
33
Dockerfile
33
Dockerfile
@@ -1,6 +1,35 @@
|
||||
FROM php:8.4-fpm
|
||||
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
curl \
|
||||
libpng-dev \
|
||||
libonig-dev \
|
||||
libxml2-dev \
|
||||
zip \
|
||||
unzip \
|
||||
libzip-dev \
|
||||
libicu-dev
|
||||
|
||||
# Clear cache
|
||||
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install PHP extensions
|
||||
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd zip intl
|
||||
|
||||
# Get latest Composer
|
||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /var/www
|
||||
|
||||
# Copy existing application directory contents
|
||||
COPY --chown=www-data:www-data . /var/www
|
||||
|
||||
# Change current user to www
|
||||
USER www-data
|
||||
|
||||
# Expose port 8000 and start php-fpm server
|
||||
EXPOSE 8000
|
||||
CMD ["php", "artisan", "serve", "--host=0.0.0.0", "--port=8000"]
|
||||
|
||||
Reference in New Issue
Block a user