-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathDockerfile
More file actions
73 lines (60 loc) · 2.82 KB
/
Copy pathDockerfile
File metadata and controls
73 lines (60 loc) · 2.82 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# SPDX-FileCopyrightText: 2017 - 2026 Badge.Team contributors
# SPDX-License-Identifier: MIT
# Dockerfile
FROM php:8.4-cli
WORKDIR /app
COPY . /app
COPY .env.dev /app/.env
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends \
python3-pip pyflakes3 git zip unzip sudo wget curl gnupg ca-certificates \
zlib1g-dev libzip-dev libicu-dev libpng-dev libjpeg-dev libfreetype6-dev libwebp-dev \
libonig-dev libgmp-dev iverilog yosys arachne-pnr fpga-icestorm \
&& ln -sf /usr/bin/pyflakes3 /usr/local/bin/pyflakes \
&& rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \
&& docker-php-ext-install -j"$(nproc)" pdo pdo_mysql mysqli pcntl zip intl gd mbstring gmp exif
# PHP ships with upload_max_filesize=2M and post_max_size=8M, well under the
# 32 MB the uploader offers. memory_limit has to hold a whole file too, since
# content is read into a string before it is stored.
RUN { \
echo 'upload_max_filesize = 32M'; \
echo 'post_max_size = 40M'; \
echo 'memory_limit = 256M'; \
} > /usr/local/etc/php/conf.d/hatchery.ini
ENV COMPOSER_HOME=/composer
ENV COMPOSER_ALLOW_SUPERUSER=1
COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer
ENV PATH=./vendor/bin:/composer/vendor/bin:$PATH
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \
&& rm -rf /var/lib/apt/lists/*
# The MAX_WBITS tweak makes minigzip produce streams the badges can inflate.
# Retry and verify: a bad response from the mirror used to be unpacked blindly,
# which failed later with "not in gzip format" instead of saying what went wrong.
ENV ZLIB_VERSION=1.2.11
ENV ZLIB_SHA256=c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1
# zlib.net regularly refuses CI traffic, so fall back to the SourceForge
# mirror, which serves a byte identical tarball. Each candidate is only
# accepted once its checksum matches.
RUN set -eu; \
ok=0; \
for url in \
"https://zlib.net/fossils/zlib-${ZLIB_VERSION}.tar.gz" \
"https://sourceforge.net/projects/libpng/files/zlib/${ZLIB_VERSION}/zlib-${ZLIB_VERSION}.tar.gz/download" \
; do \
if curl -fsSL --retry 5 --retry-delay 3 --retry-all-errors -o zlib.tar.gz "$url" \
&& echo "${ZLIB_SHA256} zlib.tar.gz" | sha256sum -c -; then ok=1; break; fi; \
done; \
[ "$ok" = 1 ]; \
tar xf zlib.tar.gz && \
cd "zlib-${ZLIB_VERSION}" && \
./configure && \
echo "#define MAX_WBITS 13\n$(cat zconf.h)" > zconf.h && \
make && \
cp minigzip /usr/local/bin/ && \
cd .. && rm -rf "zlib-${ZLIB_VERSION}" zlib.tar.gz
RUN composer install
RUN chmod -R 777 bootstrap/cache storage
RUN npm ci && npm run build
EXPOSE 8000
CMD ["php", "artisan", "serve", "--host", "0.0.0.0"]