-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
96 lines (75 loc) · 2.29 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
FROM php:8.2
MAINTAINER Attila Szeremi <[email protected]>
WORKDIR /var/www
RUN cd /var/www
RUN apt-get update && apt-get install -y \
# For installing node
curl \
wget \
gnupg \
\
# For "The `/path/to/project/node_modules/mozjpeg/vendor/cjpeg` binary doesn't seem to work correctly"
# https://github.com/imagemin/imagemin-mozjpeg/issues/26
nasm \
libpng-dev \
\
# To proxy to Swoole.
nginx \
\
# For Swoole.
libbrotli-dev \
# For composer
libzip-dev \
zlib1g-dev
# This includes the docker-php-pecl-install executable
COPY bin/docker-php-pecl-install /usr/local/bin/
# PHP extensions
RUN docker-php-ext-install \
pdo_mysql \
# Newer Laravel Swoole needs this for some reason.
pcntl \
\
zip
RUN docker-php-pecl-install swoole
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get update && \
apt-get install -y nodejs && \
node --version && \
npm --version && \
npm install -g pnpm && \
pnpm --version
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN composer --version
COPY composer.json .
COPY composer.lock .
# These directories need to exist if we composer install without hooks/scripts.
RUN mkdir -p database/seeders
RUN mkdir -p database/factories
# Do not run hooks, because they require the project files to already be there.
# We want to be able to avoid complete (slow) composer installs in the Dockerfile with caching if possible.
RUN composer install --no-scripts
COPY package.json .
COPY pnpm-lock.yaml .
RUN pnpm install
COPY resources resources
COPY vite.config.js .
COPY .babelrc .
RUN npm run build
COPY . .
RUN mkdir -p bootstrap/cache && chmod a+rwx bootstrap/cache
# This time, optimize and run hooks as well.
RUN composer install --optimize-autoloader
RUN [ \
"/bin/bash", \
"-c", \
"mkdir -p storage/framework/{cache,sessions,views} && chmod -R a+rwx storage/framework/{cache,sessions,views}" \
]
# To try and make `php artisan self-diagnosis` happy.
RUN php artisan storage:link
# The parent directory of the sqlite database must be writable.
# https://github.com/wallabag/wallabag/issues/1845#issuecomment-205726683
RUN chmod a+rw database/
# Get the GIT_SHA1 from outside (as a build arg).
ARG GIT_SHA1
ENV GIT_SHA1 $GIT_SHA1
CMD ["bin/start.sh"]