FROM quay.io/centos/centos:stream8 ENV OS=centos ENV NGINX_VERSION 1.20.2 # Install fpm RUN dnf install -y epel-release && \ dnf install -y ruby ruby-devel make gcc redhat-rpm-config rpm-build && \ gem install fpm # Copy dependencies sources folder COPY deps /tmp/bunkerweb/deps # Nginx COPY linux/nginx.repo /etc/yum.repos.d/nginx.repo RUN dnf install yum-utils -y && \ dnf install nginx-1.20.2 -y # Compile and install dependencies RUN dnf install -y python39-pip brotli brotli-devel gperftools-devel perl libxslt-devel libxml2 libxslt bash gd gd-devel gcc-c++ kernel-devel curl znc-modtcl libmpc-devel gmp-devel gawk mpfr-devel libtool pcre-devel automake autoconf readline-devel gcc make openssl-devel git zlib-devel libxml2-devel pkgconf libcurl-devel geoip-devel lmdb-libs && \ mkdir -p /opt/bunkerweb/deps && \ chmod +x /tmp/bunkerweb/deps/install.sh && \ bash /tmp/bunkerweb/deps/install.sh && \ mkdir /opt/bunkerweb/deps/python && \ pip3.9 install --no-cache-dir --require-hashes --target /opt/bunkerweb/deps/python -r /tmp/bunkerweb/deps/requirements.txt # Copy BW files # can't exclude deps from . so we are copying everything by hand COPY api /opt/bunkerweb/api COPY cli /opt/bunkerweb/cli COPY confs /opt/bunkerweb/confs COPY core /opt/bunkerweb/core COPY gen /opt/bunkerweb/gen COPY helpers /opt/bunkerweb/helpers COPY job /opt/bunkerweb/job COPY lua /opt/bunkerweb/lua COPY misc /opt/bunkerweb/misc COPY utils /opt/bunkerweb/utils COPY ui /opt/bunkerweb/ui COPY settings.json /opt/bunkerweb/settings.json COPY VERSION /opt/bunkerweb/VERSION # Setup BW RUN cp /opt/bunkerweb/helpers/bwcli /usr/local/bin && \ mkdir /opt/bunkerweb/configs && \ mkdir /opt/bunkerweb/cache && \ mkdir /opt/bunkerweb/plugins && \ mkdir /opt/bunkerweb/tmp && \ find /opt/bunkerweb -path /opt/bunkerweb/deps -prune -o -type f -exec chmod 0740 {} \; && \ find /opt/bunkerweb -path /opt/bunkerweb/deps -prune -o -type d -exec chmod 0750 {} \; && \ chmod 770 /opt/bunkerweb/cache /opt/bunkerweb/tmp && \ chmod 750 /opt/bunkerweb/gen/main.py /opt/bunkerweb/job/main.py /opt/bunkerweb/cli/main.py /opt/bunkerweb/helpers/*.sh /usr/local/bin/bwcli /opt/bunkerweb/ui/main.py && \ find /opt/bunkerweb/core/*/jobs/* -type f -exec chmod 750 {} \; && \ pip3.9 install --no-cache-dir --target /opt/bunkerweb/deps/python -r /opt/bunkerweb/ui/requirements.txt # Copy Linux files COPY linux/variables.env /opt/bunkerweb/variables.env COPY linux/bunkerweb-ui.env /opt/bunkerweb/bunkerweb-ui.env COPY linux/scripts /opt/bunkerweb/scripts COPY linux/fpm.sh /opt/fpm.sh RUN chmod +x /opt/bunkerweb/scripts/*.sh /opt/fpm.sh COPY linux/fpm-centos /opt/.fpm COPY linux/bunkerweb.service /opt/bunkerweb.service COPY linux/bunkerweb-ui.service /opt/bunkerweb-ui.service # Generate RPM at startup VOLUME /data WORKDIR /opt ENTRYPOINT ["/opt/fpm.sh", "rpm"]