92 lines
2.3 KiB
Docker
92 lines
2.3 KiB
Docker
# syntax=docker/dockerfile:1.4
|
|
FROM php:8.3-fpm-alpine AS base
|
|
|
|
RUN apk add --no-cache \
|
|
nginx \
|
|
supervisor \
|
|
curl \
|
|
git \
|
|
unzip \
|
|
libpng-dev \
|
|
libjpeg-turbo-dev \
|
|
freetype-dev \
|
|
libzip-dev \
|
|
icu-dev \
|
|
oniguruma-dev \
|
|
libpq-dev \
|
|
sqlite-dev \
|
|
linux-headers \
|
|
$PHPIZE_DEPS
|
|
|
|
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
|
|
&& docker-php-ext-install -j$(nproc) \
|
|
pdo \
|
|
pdo_mysql \
|
|
pdo_pgsql \
|
|
pdo_sqlite \
|
|
gd \
|
|
zip \
|
|
intl \
|
|
mbstring \
|
|
opcache \
|
|
bcmath \
|
|
pcntl
|
|
|
|
RUN pecl install redis && docker-php-ext-enable redis
|
|
|
|
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
|
|
COPY docker/php/opcache.ini /usr/local/etc/php/conf.d/opcache.ini
|
|
COPY docker/php/php.ini /usr/local/etc/php/conf.d/custom.ini
|
|
|
|
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
|
|
|
|
WORKDIR /var/www/html
|
|
|
|
COPY docker/nginx/nginx.conf /etc/nginx/nginx.conf
|
|
COPY docker/nginx/default.conf /etc/nginx/http.d/default.conf
|
|
|
|
COPY docker/supervisor/supervisord.conf /etc/supervisord.conf
|
|
|
|
COPY docker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
|
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
|
|
|
# ================================
|
|
# Development stage
|
|
# ================================
|
|
FROM base AS development
|
|
|
|
RUN apk add --no-cache nodejs npm
|
|
|
|
COPY --chown=www-data:www-data . .
|
|
|
|
RUN git config --global url."https://github.com/".insteadOf "git@github.com:" \
|
|
&& composer install --optimize-autoloader
|
|
|
|
RUN chown -R www-data:www-data /var/www/html \
|
|
&& chmod -R 775 storage bootstrap/cache
|
|
|
|
EXPOSE 8000
|
|
|
|
ENTRYPOINT ["docker-entrypoint.sh"]
|
|
CMD ["supervisord", "-c", "/etc/supervisord.conf"]
|
|
|
|
# ================================
|
|
# Production stage
|
|
# ================================
|
|
FROM base AS production
|
|
|
|
COPY --chown=www-data:www-data . .
|
|
|
|
RUN git config --global url."https://github.com/".insteadOf "git@github.com:" \
|
|
&& composer install --no-dev --optimize-autoloader --no-interaction --no-progress
|
|
|
|
RUN chown -R www-data:www-data /var/www/html \
|
|
&& chmod -R 775 storage bootstrap/cache
|
|
|
|
RUN mkdir -p database && touch database/database.sqlite && chown www-data:www-data database/database.sqlite
|
|
|
|
EXPOSE 8000
|
|
|
|
ENTRYPOINT ["docker-entrypoint.sh"]
|
|
CMD ["supervisord", "-c", "/etc/supervisord.conf"]
|