2024-11-05 11:03:22 +02:00
|
|
|
# Build stage
|
|
|
|
FROM node:18-alpine AS node-builder
|
2024-11-04 16:45:27 +02:00
|
|
|
|
2024-11-05 11:03:22 +02:00
|
|
|
WORKDIR /app
|
2024-11-04 16:45:27 +02:00
|
|
|
|
2024-11-05 11:03:22 +02:00
|
|
|
COPY . .
|
|
|
|
RUN npm run build
|
2024-11-04 16:45:27 +02:00
|
|
|
|
2024-11-05 11:03:22 +02:00
|
|
|
# PHP stage
|
|
|
|
FROM php:8.3-fpm-alpine
|
2024-11-04 16:45:27 +02:00
|
|
|
|
2024-11-05 11:03:22 +02:00
|
|
|
# Install system packages
|
|
|
|
RUN apk add --no-cache \
|
2024-11-04 16:45:27 +02:00
|
|
|
nginx \
|
|
|
|
supervisor \
|
|
|
|
curl \
|
|
|
|
npm \
|
|
|
|
nano \
|
|
|
|
cmake \
|
2024-11-05 11:03:22 +02:00
|
|
|
gettext
|
2024-11-04 16:45:27 +02:00
|
|
|
|
2024-11-05 11:03:22 +02:00
|
|
|
# Install PHP modules
|
|
|
|
RUN apk add --no-cache --virtual .build-deps \
|
2024-11-04 16:45:27 +02:00
|
|
|
libzip-dev \
|
2024-11-05 11:03:22 +02:00
|
|
|
freetype-dev \
|
2024-11-04 16:45:27 +02:00
|
|
|
libpng-dev \
|
2024-11-05 11:03:22 +02:00
|
|
|
libjpeg-turbo-dev \
|
2024-11-04 16:45:27 +02:00
|
|
|
libwebp-dev \
|
2024-11-05 11:03:22 +02:00
|
|
|
bzip2-dev \
|
|
|
|
curl-dev \
|
|
|
|
tidyhtml-dev \
|
2024-11-04 16:45:27 +02:00
|
|
|
libxslt-dev \
|
2024-11-05 11:03:22 +02:00
|
|
|
oniguruma-dev \
|
|
|
|
postgresql-dev \
|
|
|
|
sqlite-dev \
|
|
|
|
libzip \
|
|
|
|
bzip2 \
|
|
|
|
libxslt \
|
|
|
|
oniguruma \
|
|
|
|
sqlite-libs \
|
|
|
|
&& docker-php-ext-install -j$(nproc) \
|
2024-11-04 16:45:27 +02:00
|
|
|
mbstring \
|
|
|
|
xml \
|
|
|
|
dom \
|
|
|
|
zip \
|
|
|
|
intl \
|
|
|
|
curl \
|
|
|
|
calendar \
|
|
|
|
pdo_sqlite \
|
2024-11-05 11:03:22 +02:00
|
|
|
bcmath \
|
|
|
|
&& apk del .build-deps
|
2024-11-04 16:45:27 +02:00
|
|
|
|
2024-11-04 18:07:51 +02:00
|
|
|
# Configure php-fpm
|
|
|
|
RUN sed -i 's/listen = 127.0.0.1:9000/listen = \/run\/php\/php-fpm.sock/' /usr/local/etc/php-fpm.d/www.conf \
|
|
|
|
&& sed -i 's/;listen.owner = www-data/listen.owner = www-data/' /usr/local/etc/php-fpm.d/www.conf \
|
|
|
|
&& sed -i 's/;listen.group = www-data/listen.group = www-data/' /usr/local/etc/php-fpm.d/www.conf \
|
|
|
|
&& sed -i 's/;listen.mode = 0660/listen.mode = 0660/' /usr/local/etc/php-fpm.d/www.conf \
|
|
|
|
&& cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini \
|
|
|
|
&& sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 200M/' /usr/local/etc/php/php.ini \
|
|
|
|
&& sed -i 's/post_max_size = 8M/post_max_size = 200M/' /usr/local/etc/php/php.ini
|
2024-11-04 17:20:43 +02:00
|
|
|
|
2024-11-05 11:03:22 +02:00
|
|
|
# Copy configurations
|
2024-11-04 18:07:51 +02:00
|
|
|
COPY ./docker/conf/etc /etc
|
2024-11-04 16:45:27 +02:00
|
|
|
|
2024-11-05 11:03:22 +02:00
|
|
|
# Copy built application from node stage
|
|
|
|
COPY --from=node-builder /app/dist /var/www/html
|
|
|
|
COPY --from=node-builder /app/api /var/www/html/api
|
2024-11-04 16:45:27 +02:00
|
|
|
|
2024-11-05 11:03:22 +02:00
|
|
|
# Set permissions
|
|
|
|
RUN chown -R www-data:www-data /var/www/html
|
2024-11-04 16:45:27 +02:00
|
|
|
|
2024-11-05 11:03:22 +02:00
|
|
|
# Create system dirs
|
|
|
|
RUN mkdir -p /var/run && \
|
|
|
|
mkdir -p /run/php
|
2024-11-04 16:45:27 +02:00
|
|
|
|
2024-11-05 11:03:22 +02:00
|
|
|
# Copy and set entrypoint
|
2024-11-04 16:45:27 +02:00
|
|
|
COPY ./entrypoint.sh /
|
|
|
|
|
2024-11-05 11:03:22 +02:00
|
|
|
CMD ["/bin/sh", "/entrypoint.sh"]
|
|
|
|
|
|
|
|
EXPOSE 80
|