40 lines
1007 B
Docker
40 lines
1007 B
Docker
FROM php:8.4-cli
|
|
|
|
WORKDIR /var/www/html
|
|
|
|
ENV APP_ENV=production \
|
|
APP_DEBUG=false \
|
|
PHP_OPCACHE_ENABLE=1 \
|
|
PHP_OPCACHE_VALIDATE_TIMESTAMPS=0 \
|
|
PHP_OPCACHE_MAX_ACCELERATED_FILES=10000 \
|
|
PHP_OPCACHE_MEMORY_CONSUMPTION=128 \
|
|
PORT=8080
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
bash \
|
|
ca-certificates \
|
|
curl \
|
|
git \
|
|
unzip \
|
|
pwgen \
|
|
xkcdpass \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
|
|
|
|
COPY . /var/www/html/
|
|
|
|
RUN composer install --no-dev --optimize-autoloader --no-interaction --prefer-dist \
|
|
&& mkdir -p logs \
|
|
&& chmod 755 logs \
|
|
&& if [ ! -f .env ]; then cp .env.example .env; fi \
|
|
&& chown -R www-data:www-data /var/www/html
|
|
|
|
EXPOSE 8080
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
|
|
CMD curl -fsS http://127.0.0.1:8080/ >/dev/null || exit 1
|
|
|
|
CMD ["php", "-S", "0.0.0.0:8080", "-t", "public"]
|