-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
65 lines (47 loc) · 1.75 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
# 依赖构建
FROM composer AS composer
COPY .env.example .env
# 复制项目源码
COPY . /app
# 删除vendor文件减小体积
RUN rm vendor.zip
# 开始构建
RUN composer install --optimize-autoloader --no-interaction --no-progress
FROM trafex/php-nginx:3.6.0
USER root
RUN PHP_VERSION=$(php -v | head -n1 | cut -d' ' -f2 | cut -d. -f1-2) \
&& mkdir -p /tmp/sourceguardian \
&& cd /tmp/sourceguardian \
&& curl -Os https://www.sourceguardian.com/loaders/download/loaders.linux-x86_64.tar.gz \
&& tar xzf loaders.linux-x86_64.tar.gz \
&& cp ixed.${PHP_VERSION}.lin "$(php -i | grep '^extension_dir =' | cut -d' ' -f3)/sourceguardian.so" \
&& echo "extension=sourceguardian.so" > $PHP_INI_DIR/conf.d/15-sourceguardian.ini \
&& rm -rf /tmp/sourceguardian
RUN apk add --no-cache openssl php83-pdo php83-pdo_mysql eudev-libs
# 补全环境
RUN apk update && \
apk upgrade && \
apk add tzdata && \
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone
# 复制项目源码
COPY .docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY .docker/fpm-pool.conf ${PHP_INI_DIR}/php-fpm.d/www.conf
COPY .docker/nginx.conf /etc/nginx/nginx.conf
COPY .docker/default.conf /etc/nginx/conf.d/default.conf
COPY .docker/entrypoint.sh /entrypoint.sh
# 复制构建后项目源码
RUN rm -rf /var/www/html
COPY --from=composer /app /var/www/HkList
# 赋权
RUN chmod a+x /entrypoint.sh
###########################################################################
# 默认工作目录
WORKDIR /var/www/html
# 开放端口
EXPOSE 8080
# 映射源码目录
VOLUME ["/var/www/html"]
# 启动
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]