Files
MKM/Dockerfile
Jp 87fd507618 chore(docker): move WORKDIR declaration earlier and reorder steps
Set working directory before copying files to avoid potential conflicts with host files. Also reorder Dockerfile steps for better logical flow and maintainability.
2026-02-25 22:52:20 +08:00

40 lines
958 B
Docker

FROM php:8.4-fpm
# Set working directory early to avoid conflicts with host files
WORKDIR /var/www
# 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
# Install PHP extensions installer
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN chmod +x /usr/local/bin/install-php-extensions && \
install-php-extensions pdo_mysql mbstring exif pcntl bcmath gd zip intl
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Copy application files
COPY --chown=www-data:www-data . /var/www
# Change current user to www
USER www-data
# Expose port 8000
EXPOSE 8000
CMD ["php", "artisan", "serve", "--host=0.0.0.0", "--port=8000"]