Skip to content

A self-hosted media server and file management system

Faster docker build by seperating composer

aminnausinc77372753db5
diff --git a/Dockerfile b/Dockerfile
index c1edf493..185d3ec5 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM php:8.3.16-fpm-alpine AS backend
+FROM php:8.3.16-fpm-alpine AS composer
RUN apk update && apk add --no-cache \
bash \
@@ -10,10 +10,7 @@ RUN apk update && apk add --no-cache \
libzip-dev \
oniguruma-dev \
postgresql-dev \
- postgresql-client \
- ffmpeg \
- exiftool \
- supervisor
+ postgresql-client
# Install PHP extensions
RUN docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \
@@ -23,30 +20,39 @@ RUN docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \
# Install Composer
COPY --from=composer/composer:latest-bin /composer /usr/bin/composer
-RUN echo "error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED" > /usr/local/etc/php/conf.d/error_reporting.ini
-
-# # Create Supervisor directory
-# RUN mkdir -p /etc/supervisor/conf.d
+WORKDIR /var/www/html
-# # Copy Supervisor main config
-# COPY docker/supervisor/supervisord.conf /etc/supervisord.conf
-# # Copy Supervisor configuration
-# COPY docker/supervisor/laravel-worker.conf /etc/supervisor/conf.d/laravel-worker.conf
+COPY composer.lock composer.lock
+COPY composer.json composer.json
+RUN composer install --no-dev --optimize-autoloader --no-interaction --no-scripts
-# # Copy crontab file
-# COPY docker/crontab /etc/crontabs/www-data
+FROM php:8.3.16-fpm-alpine AS backend
-# # Ensure correct permissions
-# RUN chmod 0644 /etc/crontabs/www-data
+RUN apk update && apk add --no-cache \
+ bash \
+ git \
+ freetype-dev \
+ libjpeg-turbo-dev \
+ libpng-dev \
+ libwebp-dev \
+ libzip-dev \
+ oniguruma-dev \
+ postgresql-dev \
+ postgresql-client \
+ ffmpeg \
+ exiftool
-# RUN crond
+# Install PHP extensions
+RUN docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \
+ && docker-php-ext-install gd \
+ && docker-php-ext-install pdo pdo_pgsql mbstring zip exif pcntl bcmath opcache
WORKDIR /var/www/html
COPY . .
+COPY --from=composer /var/www/html/vendor ./vendor
-RUN composer install --no-dev --optimize-autoloader --no-interaction --no-scripts
RUN chmod o+w ./storage/ -R
RUN chmod o+w ./public/ -R