-
-
Notifications
You must be signed in to change notification settings - Fork 147
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (35 loc) · 2 KB
/
Dockerfile
File metadata and controls
49 lines (35 loc) · 2 KB
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
FROM php:8.5-fpm-alpine AS builder
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
RUN apk add --no-cache git unzip gmp-dev sqlite-dev \
&& docker-php-ext-install -j$(nproc) gmp pdo_sqlite
COPY composer.json composer.lock /var/www/html/
WORKDIR /var/www/html/
RUN composer install --no-dev --optimize-autoloader --no-interaction
FROM builder AS vendor-clean
RUN set -eux; \
cd /var/www/html/vendor/twbs/bootstrap \
&& find . -mindepth 1 -maxdepth 1 ! -name dist ! -name composer.json -exec rm -rf {} + \
&& cd dist/css && find . ! -name 'bootstrap.min.css' ! -name 'bootstrap.min.css.map' ! -name '.' -exec rm -f {} + \
&& cd ../js && find . ! -name 'bootstrap.bundle.min.js' ! -name 'bootstrap.bundle.min.js.map' ! -name '.' -exec rm -f {} + \
&& cd /var/www/html/vendor/twbs/bootstrap-icons \
&& find . -mindepth 1 -maxdepth 1 ! -name font ! -name composer.json -exec rm -rf {} + \
&& cd /var/www/html \
&& find vendor/ -type f \( -name '*.md' -o -name 'LICENSE*' -o -name 'CHANGELOG*' -o -name '.gitignore' -o -name '.gitattributes' \) -delete \
&& find vendor/ -type d \( -name 'test' -o -name 'tests' -o -name 'Tests' -o -name 'doc' -o -name 'docs' \) -exec rm -rf {} + 2>/dev/null || true
FROM php:8.5-fpm-alpine
COPY --from=caddy:2-alpine /usr/bin/caddy /usr/bin/caddy
RUN apk add --no-cache openssh-client openssl gmp sqlite-libs
COPY --from=builder /usr/local/lib/php/extensions/ /usr/local/lib/php/extensions/
COPY --from=builder /usr/local/etc/php/conf.d/ /usr/local/etc/php/conf.d/
COPY --from=vendor-clean /var/www/html/vendor/ /var/www/html/vendor/
COPY Caddyfile /etc/caddy/Caddyfile
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
COPY . /var/www/html/
WORKDIR /var/www/html/
RUN mkdir -p /var/log \
&& touch /var/log/looking-glass.log \
&& chown www-data:www-data /var/log/looking-glass.log \
&& chown www-data:www-data /var/www/html/
EXPOSE 80
ENTRYPOINT ["docker-entrypoint.sh"]