forked from spatie/Mailcoach
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
65 lines (42 loc) · 1.86 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
ARG PHP_VERSION=8.3
ARG NODE_VERSION=20
FROM node:${NODE_VERSION}-alpine AS node
# https://serversideup.net/open-source/docker-php/docs/getting-started/installation
FROM serversideup/php:${PHP_VERSION}-fpm-nginx-alpine AS base
ENV PHP_OPCACHE_ENABLE=1
ENV HEALTHCHECK_PATH=/up
ARG COMPOSER_AUTH
ENV COMPOSER_AUTH="${COMPOSER_AUTH}"
##############################################################################
COPY --from=node /usr/lib /usr/lib
COPY --from=node /usr/local/lib /usr/local/lib
COPY --from=node /usr/local/include /usr/local/include
COPY --from=node /usr/local/bin /usr/local/bin
##############################################################################
WORKDIR /var/www/html
COPY --chown=www-data:www-data . .
# Fix permissions
# TODO: find alternative way to fix permissions
RUN chown -R www-data:www-data storage && \
chmod -R 775 storage
##############################################################################
USER root
# Laravel medialibrary requirements - https://spatie.be/docs/laravel-medialibrary/v11/installation-setup#content-setting-up-optimization-tools
RUN docker-php-serversideup-dep-install-alpine "ffmpeg jpegoptim optipng pngquant gifsicle libavif"
RUN install-php-extensions \
# Laravel requirements
bcmath intl \
# Laravel medialibrary
exif gd imagick/imagick@master
# TODO: Restore imagick version when imagick supports PHP 8.3 officially
RUN npm install -g --no-audit svgo
USER www-data
RUN composer install --no-dev --prefer-dist --optimize-autoloader --no-interaction
##############################################################################
RUN npm ci --include=dev --no-audit && \
# Laravel medialibrary requirements
npm cache clean --force
RUN npm run build
##############################################################################
# Pre-deploy scripts
RUN composer run-script predeploy