-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile-deb
80 lines (65 loc) · 3.29 KB
/
Dockerfile-deb
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
# Dockerfile for building libnginx-mod-http-dav-ext for Debian / Ubuntu
#
# Usage :
#
# docker build -t build-nginx-webdav -f Dockerfile-deb \
# --build-arg DISTRIB=debian --build-arg RELEASE=bookworm \
# --build-arg NGINX_VERSION=1.18.0 --build-arg DAV_VERSION=3.0.0 .
#
# Or Ubuntu :
#
# docker build -t build-nginx-webdav -f Dockerfile-deb \
# --build-arg DISTRIB=ubuntu --build-arg RELEASE=noble \
# --build-arg NGINX_VERSION=1.18.0 --build-arg DAV_VERSION=3.0.0 .
#
# Then :
#
# docker run build-nginx-webdav
# docker cp $(docker ps -l -q):/src ~/Downloads/
# And once you don't need it anymore :
# docker rm $(docker ps -l -q)
#
# Latest nginx-dav-ext-module version : https://github.com/arut/nginx-dav-ext-module/releases
# Or :
# curl -s https://api.github.com/repos/arut/nginx-dav-ext-module/tags |grep "name" |head -1 |sed -n "s/^.*v\(.*\)\".*$/\1/p"
#
# Latest nginx version : https://nginx.org/en/download.html
# Or :
# curl -s https://nginx.org/packages/debian/pool/nginx/n/nginx/ |grep '"nginx_' | sed -n "s/^.*\">nginx_\(.*\)\~.*$/\1/p" |sort -Vr |head -1| cut -d'-' -f1
ARG DISTRIB=debian
ARG RELEASE=bookworm
FROM ${DISTRIB}:${RELEASE}
LABEL org.opencontainers.image.authors="Cyril Aknine <[email protected]>"
ARG DISTRIB
ARG RELEASE
#ARG CHANGELOG_MSG
ARG DEBIAN_FRONTEND="noninteractive"
ENV TZ=Europe/Paris
RUN ln -fs /usr/share/zoneinfo/Europe/Paris /etc/localtime && DEBIAN_FRONTEND=noninteractive TZ=Europe/Paris \
apt-get update && apt-get --no-install-recommends --no-install-suggests -y install \
wget ca-certificates curl openssl gnupg2 apt-transport-https \
unzip make libpcre3-dev zlib1g-dev build-essential devscripts \
debhelper quilt lsb-release libssl-dev lintian uuid-dev \
libxml2-dev libxslt1-dev
ARG NGINX_VERSION=1.18.0
ARG NGINX_DEB_RELEASE=1
ARG DAV_VERSION=3.0.0
WORKDIR /root
RUN wget -qO - https://github.com/arut/nginx-dav-ext-module/archive/v${DAV_VERSION}.tar.gz | tar zxvf -
RUN wget -qO - https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz | tar zxvf -
COPY debian nginx-${NGINX_VERSION}/debian
RUN sed -i "s/bullseye; urgency/${RELEASE}; urgency/g" nginx-${NGINX_VERSION}/debian/changelog
RUN sed -i "s/~bullseye)/~${RELEASE})/g" nginx-${NGINX_VERSION}/debian/changelog
RUN sed -i "s/{NGINX_VERSION}/${NGINX_VERSION}-${NGINX_DEB_RELEASE}~${RELEASE}/g" nginx-${NGINX_VERSION}/debian/control
RUN cd nginx-${NGINX_VERSION} && dpkg-buildpackage
RUN mkdir /src && mv libnginx-mod-http-dav-ext* /src/ && cp nginx-${NGINX_VERSION}/debian/changelog /src/
RUN dpkg -c /src/libnginx-mod-http-dav-ext_*.deb
RUN curl -L https://nginx.org/keys/nginx_signing.key | apt-key add -
RUN echo "deb https://nginx.org/packages/${DISTRIB}/ ${RELEASE} nginx" >> /etc/apt/sources.list.d/nginx.list
RUN apt-get update && apt-get -V --no-install-recommends --no-install-suggests -y install nginx=${NGINX_VERSION}-${NGINX_DEB_RELEASE}~${RELEASE}
RUN dpkg -i /src/libnginx-mod-http-dav-ext_*.deb && \
sed -i '1iload_module modules/ngx_http_dav_ext_module.so;' /etc/nginx/nginx.conf && \
nginx -t && /etc/init.d/nginx start && echo "Testing NGiNX headers for dav-ext presence : " && \
curl -s -i -X PROPFIND -H 'Depth: 1' http://localhost/ |grep '<D:multistatus xmlns:D="DAV:">'
RUN dpkg -r libnginx-mod-http-dav-ext
RUN dpkg -P libnginx-mod-http-dav-ext