try with multi stage

This commit is contained in:
holzi1005 2025-01-20 20:46:42 +01:00
parent bf8eedca92
commit 2378a77b2f

View file

@ -1,6 +1,28 @@
ARG PHP_IMAGE_VERSION=3.20.6
FROM erseco/alpine-php-webserver:${PHP_IMAGE_VERSION}
FROM thecodingmachine/php:8.3-v4-fpm-node22 AS builder
ARG VERSION
COPY . /var/www/html
USER root
RUN npm install \
&& npm run build
RUN composer install --no-scripts
RUN sed -i "s/^laF_version=.*/laF_version=${VERSION}/" .env
RUN tar \
--exclude='./.github' \
--exclude='./.git' \
--exclude='./node_modules' \
--exclude='./var/cache' \
--exclude='./var/log' \
-zcvf /artifact.tgz .
FROM git.h2-invent.com/public-system-design/alpine-php8-webserver:${PHP_IMAGE_VERSION}
ARG VERSION
ARG SUPERCRONIC_VERSION=0.2.33
@ -72,21 +94,14 @@ RUN echo "#!/bin/sh" > /docker-entrypoint-init.d/03-symfony.sh \
&& echo "php bin/console cache:clear" >> /docker-entrypoint-init.d/03-symfony.sh \
&& chmod +x /docker-entrypoint-init.d/03-symfony.sh
RUN wget https://github.com/H2-invent/jitsi-admin/releases/download/${VERSION}/application.zip -O artifact.zip \
&& unzip artifact.zip \
&& chown -R nobody public \
&& chown -R nobody theme \
&& chown -R nobody data \
&& chown -R nobody var \
&& chmod -R 700 public \
&& chmod -R 700 theme \
&& chmod -R 700 data \
&& chmod -R 700 var \
&& rm artifact.zip \
&& rm -r var/cache
USER nobody
COPY --from=builder /artifact.tgz artifact.tgz
RUN tar -zxvf artifact.tgz \
&& rm artifact.tgz \
&& rm -r var/cache
ENV nginx_root_directory=/var/www/html/public \
memory_limit=1024M \
post_max_size=20M \