Write build pipeline.
This commit is contained in:
35
Dockerfile
Normal file
35
Dockerfile
Normal file
@@ -0,0 +1,35 @@
|
||||
#Composer part
|
||||
FROM composer:2 AS composer-build
|
||||
WORKDIR /var/www/html
|
||||
|
||||
COPY . .
|
||||
RUN composer install --no-dev --no-scripts --ignore-platform-reqs
|
||||
RUN composer dumpautoload --optimize
|
||||
|
||||
#NPM part
|
||||
FROM node:21 AS npm-build
|
||||
WORKDIR /var/www/html
|
||||
|
||||
COPY --from=composer-build /var/www/html /var/www/html
|
||||
RUN npm install
|
||||
RUN npm run build
|
||||
|
||||
#Use prebuilt image
|
||||
FROM cs-git.ddnss.de/docker/php-apache-8-4:latest AS final
|
||||
WORKDIR /var/www
|
||||
COPY --from=npm-build /var/www/html /var/www
|
||||
|
||||
RUN sed -ri -e 's!/var/www/html!/var/www/public!g' /etc/apache2/sites-available/*.conf
|
||||
RUN sed -ri -e 's!/var/www/!/var/www/public!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
|
||||
RUN sed -ri -e 's!AllowOverride None!AllowOverride All!g' /etc/apache2/apache2.conf
|
||||
|
||||
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
|
||||
RUN sed -ri -e 's!upload_max_filesize = 2M!upload_max_filesize = 8M!g' $PHP_INI_DIR/php.ini
|
||||
|
||||
RUN a2enmod rewrite
|
||||
|
||||
RUN php artisan storage:link
|
||||
|
||||
RUN chown -R www-data:www-data /var/www
|
||||
|
||||
VOLUME /var/www/storage/app/public
|
||||
Reference in New Issue
Block a user