-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathDockerfile.base
66 lines (58 loc) · 2.11 KB
/
Dockerfile.base
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
ARG TAG=latest
FROM php:$TAG
ENV MEMORY_LIMIT=128m
ENV MAX_POST_BODY=10m
ENV MAX_EXECUTION_TIME=30
ENV TIMEZONE=""
# default download latest dev version
ARG URL="https://github.com/typecho/typecho/releases/download/ci/typecho.zip"
ARG CONFIG=""
ARG PHP8_SOCKETS_WORKAROUND=""
ARG PHP_EXTENSION=""
# copy init
COPY --chown=root:root ./scripts/init.sh /bin/init_typecho
COPY --chown=root:root ./scripts/download.sh /bin/download
COPY --chown=root:root ./scripts/before.sh /bin/before
COPY --chown=root:root ./scripts/after.sh /bin/after
# define function
COPY --chown=root:root ./scripts/use.sh /bin/use
# install dependencies
RUN sed -i "s/<shell>/$(use bash sh)/g" /bin/init_typecho \
&& savedAptMark="$(before)" \
&& `use "apt-get update" "apk update"` \
&& `use "apt-get install --no-install-recommends -y" "apk add --no-cache --virtual .build-deps"` \
`use - linux-headers` \
`use libfreetype6-dev freetype-dev` \
`use libjpeg62-turbo-dev libjpeg-turbo-dev` \
`use libpq-dev postgresql-dev` \
libpng-dev \
libzip-dev \
libwebp-dev \
$PHPIZE_DEPS \
unzip \
curl \
&& docker-php-ext-configure gd \
--with-freetype${CONFIG} \
--with-jpeg${CONFIG} \
--with-webp${CONFIG} \
&& docker-php-ext-install -j "$(nproc)" ${PHP_EXTENSION} \
&& CFLAGS="$CFLAGS ${PHP8_SOCKETS_WORKAROUND}" docker-php-ext-install -j "$(nproc)" \
sockets \
&& download ${URL} \
&& after "${savedAptMark}"
# config php error handler
RUN { \
echo 'error_reporting = E_ERROR | E_WARNING | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_RECOVERABLE_ERROR'; \
echo 'display_errors = Off'; \
echo 'display_startup_errors = Off'; \
echo 'log_errors = On'; \
echo 'error_log = /dev/stderr'; \
echo 'log_errors_max_len = 1024'; \
echo 'ignore_repeated_errors = On'; \
echo 'ignore_repeated_source = Off'; \
echo 'html_errors = Off'; \
} > /usr/local/etc/php/conf.d/error-logging.ini
# uninstall dependencies
RUN rm -rf /bin/use /bin/download /bin/before /bin/after
VOLUME /app
WORKDIR /app