-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
76 lines (66 loc) · 2.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
66
67
68
69
70
71
72
73
74
75
76
# syntax=docker/dockerfile:1
ARG OS_TYPE=ubuntu
ARG OS_VERSION=22.04
FROM ${OS_TYPE}:${OS_VERSION}
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get -y install tzdata apt-utils \
gcc make \
debhelper dpkg-dev quilt lsb-release libssl-dev libpcre3-dev zlib1g-dev \
libexpat1-dev libxslt1-dev libgd-dev libgeoip-dev libmhash-dev libmaxminddb-dev \
libperl-dev \
# libmodsecurity dependencies
libyajl2 liblmdb0 libfuzzy2 \
# for nginx-tests
sudo \
ffmpeg \
memcached \
softhsm2 \
libcache-memcached-fast-perl \
libcache-memcached-perl \
libcryptx-perl \
libfcgi-perl \
libprotocol-websocket-perl \
libgd-perl \
libio-socket-ssl-perl \
libscgi-perl \
libengine-pkcs11-openssl \
opensc \
uwsgi \
uwsgi-plugin-python3 \
rake \
# for nginx-otel module
git cmake libpcre3-dev pkg-config libc-ares-dev libre2-dev
# create symbolic links for nginx-tests
RUN mkdir -p /usr/local/lib/engines
RUN ln -s /usr/lib/x86_64-linux-gnu/engines-3/pkcs11.so /usr/local/lib/engines/pkcs11.so
RUN mkdir -p /usr/local/lib/softhsm
RUN ln -s /usr/lib/softhsm/libsofthsm2.so /usr/local/lib/softhsm/libsofthsm2.so
ARG LUAJIT_DEB_VERSION
ARG LUAJIT_DEB_OS_ID
RUN mkdir -p /depends
RUN curl -sSL https://github.com/hnakamur/openresty-luajit-deb-docker/releases/download/${LUAJIT_DEB_VERSION}${LUAJIT_DEB_OS_ID}/openresty-luajit-${LUAJIT_DEB_VERSION}${LUAJIT_DEB_OS_ID}.tar.gz | tar zxf - -C /depends --strip-components=2
RUN dpkg -i /depends/*.deb
ARG MODSECURITY_DEB_VERSION
ARG MODSECURITY_DEB_OS_ID
RUN mkdir -p /depends
RUN curl -sSL https://github.com/hnakamur/modsecurity-deb-docker/releases/download/${MODSECURITY_DEB_VERSION}${MODSECURITY_DEB_OS_ID}/modsecurity-${MODSECURITY_DEB_VERSION}${MODSECURITY_DEB_OS_ID}.tar.gz | tar zxf - -C /depends --strip-components=2
RUN ls -l /depends/libmodsecurity3_*.deb /depends/libmodsecurity-dev*.deb
RUN dpkg -i /depends/libmodsecurity3_*.deb
RUN dpkg -i /depends/libmodsecurity-dev*.deb
ARG SRC_DIR=/src
ARG BUILD_USER=nginx
RUN adduser --system --group ${BUILD_USER}
COPY --chown=${BUILD_USER}:${BUILD_USER} ./nginx/ ${SRC_DIR}/nginx/
COPY --chown=${BUILD_USER}:${BUILD_USER} ./modules/ ${SRC_DIR}/nginx/
USER ${BUILD_USER}
WORKDIR ${SRC_DIR}
ARG PKG_VERSION
RUN tar cf - nginx | xz > nginx_${PKG_VERSION}.orig.tar.xz
COPY --chown=${BUILD_USER}:${BUILD_USER} ./debian ${SRC_DIR}/nginx/debian/
WORKDIR ${SRC_DIR}/nginx
ARG PKG_REL_DISTRIB
RUN sed -i "s/DebRelDistrib/${PKG_REL_DISTRIB}/;s/UNRELEASED/$(lsb_release -cs)/" ${SRC_DIR}/nginx/debian/changelog
RUN dpkg-buildpackage -us -uc
COPY --chown=${BUILD_USER}:${BUILD_USER} ./nginx-tests/ ${SRC_DIR}/nginx-tests/
COPY --chown=${BUILD_USER}:${BUILD_USER} ./run-nginx-tests.sh ${SRC_DIR}/run-nginx-tests.sh
USER root