update prod dockerfile

This commit is contained in:
Andras Bacsai 2023-06-15 10:56:36 +02:00
parent 8b6598ea6b
commit 38cb3fddd9
2 changed files with 19 additions and 15 deletions

View File

@ -1,6 +1,16 @@
FROM serversideup/php:8.2-fpm-nginx as base
WORKDIR /var/www/html
COPY composer.json composer.lock ./
RUN composer install --no-dev --no-interaction --no-plugins --no-scripts --prefer-dist
COPY --chown=9999:9999 . .
RUN composer dump-autoload
FROM node:19 as static-assets FROM node:19 as static-assets
WORKDIR /app WORKDIR /app
COPY . . COPY . .
COPY --from=base --chown=9999:9999 /var/www/html .
RUN npm install RUN npm install
RUN npm run build RUN npm run build
@ -12,17 +22,11 @@ RUN apt-get -y autoremove && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/*
COPY docker/prod-ssu/nginx.conf /etc/nginx/conf.d/custom.conf COPY docker/prod-ssu/nginx.conf /etc/nginx/conf.d/custom.conf
COPY composer.json composer.lock ./ COPY --from=base --chown=9999:9999 /var/www/html .
RUN composer install --no-dev --no-interaction --no-plugins --no-scripts --prefer-dist
COPY --chown=9999:9999 . .
RUN composer dump-autoload
COPY --from=static-assets --chown=9999:9999 /app/public/build ./public/build COPY --from=static-assets --chown=9999:9999 /app/public/build ./public/build
COPY --chmod=755 docker/prod-ssu/etc/s6-overlay/ /etc/s6-overlay/ COPY --chmod=755 docker/prod-ssu/etc/s6-overlay/ /etc/s6-overlay/
RUN php artisan route:cache RUN php artisan optimize
RUN php artisan view:cache
RUN echo "alias ll='ls -al'" >>/etc/bash.bashrc RUN echo "alias ll='ls -al'" >>/etc/bash.bashrc
RUN echo "alias a='php artisan'" >>/etc/bash.bashrc RUN echo "alias a='php artisan'" >>/etc/bash.bashrc