forked from duxlong/webdav
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
64 lines (48 loc) · 2.36 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
FROM alpine
ENV USERNAME="" PASSWORD="" TZ=""
COPY nginx.conf /opt/nginx/conf/nginx.conf
COPY entrypoint.sh /
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.bfsu.edu.cn/g' /etc/apk/repositories && \
apk update && \
apk add --no-cache tzdata && \
apk add --no-cache pcre libxml2 libxslt && \
apk add --no-cache apache2-utils && \
apk add --no-cache gcc make libc-dev pcre-dev zlib-dev libxml2-dev libxslt-dev && \
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo $TZ > /etc/timezone && \
cd /tmp && \
wget https://github.com/nginx/nginx/archive/master.zip -O nginx.zip && \
unzip nginx.zip && \
wget https://github.com/arut/nginx-dav-ext-module/archive/master.zip -O dav-ext-module.zip && \
unzip dav-ext-module.zip && \
cd nginx-master && \
./auto/configure --prefix=/opt/nginx --with-http_dav_module --add-module=/tmp/nginx-dav-ext-module-master && \
make && make install && \
cd /root && \
chmod +x /entrypoint.sh && \
apk del tzdata gcc make libc-dev pcre-dev zlib-dev libxml2-dev libxslt-dev && \
rm -rf /var/cache/apk/* && \
rm -rf /tmp/*
VOLUME /data
EXPOSE 80
CMD /entrypoint.sh && /opt/nginx/sbin/nginx -g "daemon off;"
# COPY nginx.conf /opt/nginx/conf/nginx.conf
# docker hub 可以直接复制 github 中的代码
# apk add --no-cache apache2-utils
# 支持 htpasswd 命令,单用户模式创建密码用
# apk add --no-cache pcre libxml2 libxslt
# 安装 nginx 运行所必须的库
# apk add --no-cache gcc make libc-dev pcre-dev zlib-dev libxml2-dev libxslt-dev
# 安装编译工具
# wget https://github.com/nginx/nginx/archive/master.zip -O nginx.zip
# 下载 nginx 最新源码
# wget https://github.com/arut/nginx-dav-ext-module/archive/master.zip -O dav-ext-module.zip
# 下载 nginx-dav-ext-module 最新源码
# ./auto/configure --prefix=/opt/nginx --with-http_dav_module --add-module=/tmp/nginx-dav-ext-module-master
# 编译安装到 /opt/nginx ,并增加 web_dav 模块,网上教程有误
# apk del gcc make libc-dev pcre-dev zlib-dev libxml2-dev libxslt-dev
# 卸载编译工具,缩减镜像体积
# CMD /entrypoint.sh && /opt/nginx/sbin/nginx -g "daemon off;"
# 执行 entrypoint.sh 判断是单用户模式还是多用户模式
# 源码编译安装的 nginx 未加入环境变量,所以用绝对路径运行 nginx
# nginx 关闭后台运行,才能在 docker 中运行