forked from wilson212/bf2stats
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.asp
79 lines (67 loc) · 2.52 KB
/
Dockerfile.asp
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
ARG IMAGE=php:7.4-fpm-alpine
FROM $IMAGE AS build
# Set permissions for 'www-data' user
COPY ./src/ASP /src/ASP
WORKDIR /src/ASP
RUN chown -R www-data:www-data . \
&& find . -type d -exec chmod 750 {} \; \
&& find . -type f -exec chmod 640 {} \;
FROM $IMAGE AS dev
# Install nginx and supervisor for multi-process container
RUN apk add --no-cache ca-certificates nginx supervisor
# opcache
RUN docker-php-ext-install opcache
# mysql PDO
RUN docker-php-ext-install pdo pdo_mysql
# Xdebug: https://stackoverflow.com/questions/46825502/how-do-i-install-xdebug-on-dockers-official-php-fpm-alpine-image
# PHPIZE_DEPS: autoconf dpkg-dev dpkg file g++ gcc libc-dev make pkgconf re2c
RUN apk add --no-cache --virtual .build-dependencies $PHPIZE_DEPS \
&& pecl install xdebug-3.1.6 \
&& docker-php-ext-enable xdebug \
&& docker-php-source delete \
&& apk del .build-dependencies
RUN { \
echo "[xdebug]"; \
echo "zend_extension=xdebug"; \
echo "xdebug.mode=debug"; \
echo "xdebug.start_with_request=yes"; \
echo "xdebug.client_host=host.docker.internal"; \
echo "xdebug.client_port=9000"; \
} > /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini;
RUN set -eux; \
echo; \
php -i; \
php -m
# Add configs
COPY ./config/ASP/. /
COPY ./src/ASP/system/config/config.php /config.sample/config.php
RUN set -eux; \
chmod +x /docker-entrypoint.sh; \
chmod +x /tail.sh; \
# Symlink nginx logs
ln -sfn /dev/stdout /var/log/nginx/access.log; \
ln -sfn /dev/stderr /var/log/nginx/error.log; \
# Disable the built-in php-fpm configs, since we're using our own config
mv -v /usr/local/etc/php-fpm.d/docker.conf /usr/local/etc/php-fpm.d/docker.conf.disabled; \
mv -v /usr/local/etc/php-fpm.d/www.conf /usr/local/etc/php-fpm.d/www.conf.disabled; \
mv -v /usr/local/etc/php-fpm.d/zz-docker.conf /usr/local/etc/php-fpm.d/zz-docker.conf.disabled;
# In docker, IPs may be dynamic. This ensures we get access
ENV ADMIN_HOSTS=0.0.0.0
ENV ADMIN_BACKUP_PATH=/src/ASP/system/database/backups
# Authorize all gameservers within private IP ranges
ENV GAME_HOSTS=127.0.0.1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
VOLUME /src/ASP/system/config
VOLUME /src/ASP/system/database/backups
VOLUME /src/ASP/system/logs
VOLUME /src/ASP/system/snapshots
EXPOSE 80
EXPOSE 9000
WORKDIR /src/ASP
ENTRYPOINT []
CMD ["/docker-entrypoint.sh"]
FROM dev AS prod
# Disable xdebug
RUN set -eux; \
rm /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \
php -m;
COPY --from=build /src /src