feat(docker): refactor to use pre-built images

- Add build/load script for image management
- Use .env config for image naming and PHP version
- Switch to www-data user in Dockerfile
- Update compose.yaml to use pre-built images
- Add .dockerignore
- Simplify entrypoint script
This commit is contained in:
2025-12-10 02:57:17 +03:00
parent 8795c78230
commit 49b7d83dfa
8 changed files with 103 additions and 61 deletions

View File

@@ -1,31 +1,21 @@
FROM php:8.3-fpm
ARG PHP_VERSION=8.3-fpm
FROM php:${PHP_VERSION}
ARG UID
ARG GID
RUN apt-get update && apt-get install -y \
RUN apt-get update && apt-get install -y --no-install-recommends \
libpng-dev libonig-dev libxml2-dev libzip-dev \
zip unzip git \
netcat-traditional \
libpng-dev \
libonig-dev \
libxml2-dev \
libzip-dev \
zip \
unzip \
git \
&& docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd zip \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
COPY --chown=www-data:www-data ./docker/docker-entrypoint.sh /usr/local/bin/
COPY ./docker/php-fpm.conf /usr/local/etc/php-fpm.d/zz-docker.conf
COPY ./docker/docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
RUN groupadd -g $GID laravel && useradd -u $UID -g $GID -m laravel
USER laravel
USER www-data
WORKDIR /var/www
EXPOSE 9000