@@ -13,14 +13,18 @@ WORKDIR /app
1313COPY composer.json composer.lock ./
1414
1515# Install dependencies (no dev packages for production)
16+ # Remove markdown and test directories to slim down the image
1617RUN composer install \
1718 --no-dev \
1819 --no-interaction \
1920 --no-progress \
2021 --no-scripts \
2122 --prefer-dist \
2223 --optimize-autoloader \
23- --ignore-platform-reqs
24+ --ignore-platform-reqs \
25+ && find vendor \
26+ \( -iname "*.md" -o -iname "test" -o -iname "tests" \) \
27+ -exec rm -rf {} +
2428
2529# ============================================================================
2630# Stage 2: Node.js Build for Frontend Assets
@@ -63,32 +67,30 @@ LABEL org.opencontainers.image.source="https://github.com/LycheeOrg/Lychee"
6367# hadolint ignore=DL3018
6468RUN apk add --no-cache \
6569 exiftool \
66- shadow \
70+ shadow \
6771 ffmpeg \
6872 gd \
6973 grep \
7074 imagemagick \
7175 jpegoptim \
72- netcat-openbsd \
73- unzip \
76+ netcat-openbsd \
77+ unzip \
7478 curl \
7579 && install-php-extensions \
7680 pdo_mysql \
7781 pdo_pgsql \
7882 gd \
7983 zip \
80- dom \
8184 bcmath \
8285 sodium \
8386 opcache \
8487 pcntl \
85- exif \
86- imagick \
87- intl \
88- redis \
89- tokenizer \
90- && rm -rf /var/cache/apk/* \
91- && apk del shadow
88+ exif \
89+ imagick \
90+ intl \
91+ redis \
92+ tokenizer \
93+ && rm -rf /var/cache/apk/*
9294
9395WORKDIR /app
9496
@@ -111,18 +113,18 @@ RUN mkdir -p storage/framework/cache \
111113 && chown -R www-data:www-data storage bootstrap/cache public/dist \
112114 && chmod -R 750 storage bootstrap/cache \
113115 && chmod -R 755 public/dist \
114- && touch /app/frankenphp_target \
115- && touch /app/public/dist/user.css \
116- && touch /app/public/dist/custom.js \
117- && chown www-data:www-data /app/public/dist/user.css /app/public/dist/custom.js \
118- && chmod 644 /app/public/dist/user.css /app/public/dist/custom.js \
119- && cp $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini \
116+ && touch /app/frankenphp_target \
117+ && touch /app/public/dist/user.css \
118+ && touch /app/public/dist/custom.js \
119+ && chown www-data:www-data /app/public/dist/user.css /app/public/dist/custom.js \
120+ && chmod 644 /app/public/dist/user.css /app/public/dist/custom.js \
121+ && cp $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini \
120122 && echo "upload_max_filesize=110M" > $PHP_INI_DIR/conf.d/custom.ini \
121123 && echo "post_max_size=110M" >> $PHP_INI_DIR/conf.d/custom.ini \
122- && echo "max_execution_time=3000" >> $PHP_INI_DIR/conf.d/custom.ini \
123- && echo "expose_php=Off" >> $PHP_INI_DIR/conf.d/custom.ini \
124- && echo "display_errors=Off" >> $PHP_INI_DIR/conf.d/custom.ini \
125- && echo "log_errors=On" >> $PHP_INI_DIR/conf.d/custom.ini
124+ && echo "max_execution_time=3000" >> $PHP_INI_DIR/conf.d/custom.ini \
125+ && echo "expose_php=Off" >> $PHP_INI_DIR/conf.d/custom.ini \
126+ && echo "display_errors=Off" >> $PHP_INI_DIR/conf.d/custom.ini \
127+ && echo "log_errors=On" >> $PHP_INI_DIR/conf.d/custom.ini
126128
127129# Copy entrypoint and validation scripts
128130COPY docker/scripts/entrypoint.sh /usr/local/bin/entrypoint.sh
0 commit comments