-
Notifications
You must be signed in to change notification settings - Fork 79
/
Dockerfile
183 lines (150 loc) · 4.65 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
ARG HUMHUB_VERSION
ARG VCS_REF
ARG BUILD_DEPS="\
ca-certificates \
nodejs \
npm \
php82 \
php82-ctype \
php82-curl \
php82-dom \
php82-exif \
php82-fileinfo \
php82-gd \
php82-iconv \
php82-intl \
php82-json \
php82-ldap \
php82-mbstring \
php82-openssl \
php82-pdo_mysql \
php82-phar \
php82-simplexml \
php82-tokenizer \
php82-xml \
php82-xmlreader \
php82-xmlwriter \
php82-zip \
composer \
tzdata \
"
ARG RUNTIME_DEPS="\
ca-certificates \
curl \
imagemagick \
libintl \
php82 \
php82-apcu \
php82-bcmath \
php82-ctype \
php82-curl \
php82-dom \
php82-exif \
php82-fileinfo \
php82-fpm \
php82-gd \
php82-gmp \
php82-iconv \
php82-intl \
php82-json \
php82-ldap \
php82-mbstring \
php82-openssl \
php82-pdo_mysql \
php82-pecl-imagick \
php82-phar \
php82-session \
php82-simplexml \
php82-sqlite3 \
php82-xml \
php82-xmlreader \
php82-xmlwriter \
php82-zip \
sqlite \
supervisor \
tzdata \
"
FROM docker.io/library/alpine:3.19.4 as builder
ARG HUMHUB_VERSION
ARG BUILD_DEPS
RUN apk add --no-cache --update $BUILD_DEPS && \
rm -rf /var/cache/apk/*
WORKDIR /usr/src/
ADD https://github.com/humhub/humhub/archive/v${HUMHUB_VERSION}.tar.gz /usr/src/
RUN tar xzf v${HUMHUB_VERSION}.tar.gz && \
mv humhub-${HUMHUB_VERSION} humhub && \
rm v${HUMHUB_VERSION}.tar.gz
WORKDIR /usr/src/humhub
RUN composer config --no-plugins allow-plugins.yiisoft/yii2-composer true && \
composer install --no-ansi --no-dev --no-interaction --no-progress --no-scripts --optimize-autoloader && \
chmod +x protected/yii && \
chmod +x protected/yii.bat && \
npm install grunt && \
npm install -g grunt-cli && \
grunt build-assets && \
rm -rf ./node_modules
FROM docker.io/library/alpine:3.19.4 as base
ARG HUMHUB_VERSION
ARG RUNTIME_DEPS
LABEL name="HumHub" version=${HUMHUB_VERSION} variant="base" \
org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="HumHub" \
org.label-schema.description="HumHub is a feature rich and highly flexible OpenSource Social Network Kit written in PHP" \
org.label-schema.url="https://www.humhub.com/" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/mriedmann/humhub-docker" \
org.label-schema.vendor="HumHub GmbH" \
org.label-schema.version=${HUMHUB_VERSION} \
org.label-schema.schema-version="1.0"
RUN apk add --no-cache --update $RUNTIME_DEPS && \
apk add --no-cache --virtual temp_pkgs gettext && \
cp /usr/bin/envsubst /usr/local/bin/envsubst && \
apk del temp_pkgs && \
rm -rf /var/cache/apk/*
ENV PHP_POST_MAX_SIZE=16M
ENV PHP_UPLOAD_MAX_FILESIZE=10M
ENV PHP_MAX_EXECUTION_TIME=60
ENV PHP_MEMORY_LIMIT=1G
ENV PHP_TIMEZONE=UTC
RUN touch /var/run/supervisor.sock && \
chmod 777 /var/run/supervisor.sock
# 100=nginx 101=nginx (group)
COPY --from=builder --chown=100:101 /usr/src/humhub /var/www/localhost/htdocs/
COPY --chown=100:101 humhub/ /var/www/localhost/htdocs/
RUN mkdir -p /usr/src/humhub/protected/config/ && \
cp -R /var/www/localhost/htdocs/protected/config/* /usr/src/humhub/protected/config/ && \
rm -f var/www/localhost/htdocs/protected/config/common.php /usr/src/humhub/protected/config/common.php && \
echo "v${HUMHUB_VERSION}" > /usr/src/humhub/.version
COPY base/ /
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod 600 /etc/crontabs/nginx && \
chmod +x /docker-entrypoint.sh
VOLUME /var/www/localhost/htdocs/uploads
VOLUME /var/www/localhost/htdocs/protected/config
VOLUME /var/www/localhost/htdocs/protected/modules
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["supervisord", "-n", "-c", "/etc/supervisord.conf"]
FROM base as humhub_phponly
LABEL variant="phponly"
RUN apk add --no-cache fcgi
COPY phponly/ /
ADD https://raw.githubusercontent.com/renatomefi/php-fpm-healthcheck/master/php-fpm-healthcheck /usr/local/bin/php-fpm-healthcheck
RUN chmod +x /usr/local/bin/php-fpm-healthcheck \
&& addgroup -g 101 -S nginx \
&& adduser --uid 100 -g 101 -S nginx
EXPOSE 9000
FROM docker.io/library/nginx:1.27.2-alpine as humhub_nginx
LABEL variant="nginx"
ENV NGINX_CLIENT_MAX_BODY_SIZE=10m \
NGINX_KEEPALIVE_TIMEOUT=65 \
NGINX_UPSTREAM=humhub:9000
RUN rm -rf /etc/nginx/conf.d/*
COPY nginx/ /
COPY --from=builder --chown=nginx:nginx /usr/src/humhub/ /var/www/localhost/htdocs/
FROM base as humhub_allinone
LABEL variant="allinone"
RUN apk add --no-cache nginx && \
chown -R nginx:nginx /var/lib/nginx/
RUN rm -rf /etc/nginx/conf.d/*
COPY nginx/ /
EXPOSE 80