mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
97 lines
4.8 KiB
Text
97 lines
4.8 KiB
Text
FROM debian:bullseye-slim
|
|
|
|
ENV OS=debian
|
|
ENV NGINX_VERSION 1.24.0
|
|
|
|
# Install fpm
|
|
RUN apt update && \
|
|
apt install -y --no-install-recommends ruby ruby-dev && \
|
|
gem install fpm
|
|
|
|
# Copy dependencies sources folder
|
|
COPY src/deps /tmp/bunkerweb/deps
|
|
COPY src/scheduler/requirements.txt /tmp/req/requirements.txt
|
|
COPY src/ui/requirements.txt /tmp/req/requirements.txt.1
|
|
COPY src/common/gen/requirements.txt /tmp/req/requirements.txt.2
|
|
COPY src/common/db/requirements.txt /tmp/req/requirements.txt.3
|
|
|
|
RUN mkdir -p /usr/share/bunkerweb/deps && \
|
|
cat /tmp/req/requirements.txt /tmp/req/requirements.txt.1 /tmp/req/requirements.txt.2 /tmp/req/requirements.txt.3 > /usr/share/bunkerweb/deps/requirements.txt && \
|
|
rm -rf /tmp/req
|
|
|
|
# Nginx
|
|
RUN apt update && \
|
|
apt-get install gnupg2 ca-certificates wget -y && \
|
|
echo "deb https://nginx.org/packages/debian/ bullseye nginx" > /etc/apt/sources.list.d/nginx.list && \
|
|
echo "deb-src https://nginx.org/packages/debian/ bullseye nginx" >> /etc/apt/sources.list.d/nginx.list && \
|
|
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ABF5BD827BD9BF62 && \
|
|
apt-get update && \
|
|
apt-get install -y --no-install-recommends nginx=${NGINX_VERSION}-1~bullseye
|
|
|
|
# Compile and install dependencies
|
|
RUN apt update && \
|
|
apt install --no-install-recommends bash python3-pip libssl-dev git libpcre++-dev zlib1g-dev libxml2-dev libyajl-dev pkgconf libcurl4-openssl-dev libgeoip-dev liblmdb-dev apt-utils bash build-essential autoconf libtool automake g++ gcc libxml2-dev make musl-dev gnupg patch libreadline-dev libpcre3-dev libgd-dev -y && \
|
|
pip install --no-cache-dir --upgrade pip && \
|
|
pip install wheel && \
|
|
#mkdir -p /usr/share/bunkerweb/deps && \
|
|
chmod +x /tmp/bunkerweb/deps/install.sh && \
|
|
bash /tmp/bunkerweb/deps/install.sh && \
|
|
mkdir /usr/share/bunkerweb/deps/python && \
|
|
export MAKEFLAGS="-j$(nproc)" && \
|
|
pip install --no-cache-dir --require-hashes --target /usr/share/bunkerweb/deps/python -r /usr/share/bunkerweb/deps/requirements.txt
|
|
|
|
# Dirty fix to avoid errors with --target and packages same namespace
|
|
#RUN pip install --no-deps --no-cache-dir --require-hashes --target /usr/share/bunkerweb/deps/python -r /tmp/bunkerweb/deps/requirements.txt
|
|
|
|
# Copy files
|
|
# can't exclude deps from . so we are copying everything by hand
|
|
COPY src/bw/loading /usr/share/bunkerweb/loading
|
|
COPY src/bw/lua /usr/share/bunkerweb/lua
|
|
COPY src/bw/misc /usr/share/bunkerweb/misc
|
|
COPY src/common/api /usr/share/bunkerweb/api
|
|
COPY src/common/cli /usr/share/bunkerweb/cli
|
|
COPY src/common/confs /usr/share/bunkerweb/confs
|
|
COPY src/common/core /usr/share/bunkerweb/core
|
|
COPY src/common/db /usr/share/bunkerweb/db
|
|
COPY src/common/gen /usr/share/bunkerweb/gen
|
|
COPY src/common/helpers /usr/share/bunkerweb/helpers
|
|
COPY src/common/settings.json /usr/share/bunkerweb/settings.json
|
|
COPY src/common/utils /usr/share/bunkerweb/utils
|
|
COPY src/scheduler /usr/share/bunkerweb/scheduler
|
|
COPY src/ui /usr/share/bunkerweb/ui
|
|
COPY src/VERSION /usr/share/bunkerweb/VERSION
|
|
|
|
# Setup BW
|
|
RUN cp /usr/share/bunkerweb/helpers/bwcli /usr/bin/ && \
|
|
chmod 755 /usr/bin/bwcli && \
|
|
mkdir -p /etc/bunkerweb/configs && \
|
|
mkdir -p /var/cache/bunkerweb/ && \
|
|
mkdir -p /etc/bunkerweb/plugins && \
|
|
mkdir -p /var/tmp/bunkerweb/ && \
|
|
mkdir -p /var/run/bunkerweb/ && \
|
|
mkdir -p /var/www/ && \
|
|
mkdir -p /var/lib/bunkerweb && \
|
|
mkdir /var/www/html && \
|
|
echo "Linux" > /usr/share/bunkerweb/INTEGRATION && \
|
|
#It's a find command that will find all files in the bunkerweb directory, excluding the ui/deps directory, and then chmod them to 0740.
|
|
find /usr/share/bunkerweb -path /usr/share/bunkerweb/ui/deps -prune -o -type f -exec chmod 0740 {} \; && \
|
|
#It's a find command that will find all files in the bunkerweb directory, excluding the ui/deps directory, and then chmod them to 0740.
|
|
find /usr/share/bunkerweb -path /usr/share/bunkerweb/ui/deps -prune -o -type d -exec chmod 0750 {} \; && \
|
|
chmod 770 /var/cache/bunkerweb/ /var/tmp/bunkerweb/ /var/run/bunkerweb/ && \
|
|
chmod 750 /usr/share/bunkerweb/gen/main.py /usr/share/bunkerweb/scheduler/main.py /usr/share/bunkerweb/cli/main.py /usr/share/bunkerweb/helpers/*.sh /usr/share/bunkerweb/ui/main.py /var/www/ && \
|
|
# Don't forget to add /var/www/html on the above line
|
|
find /usr/share/bunkerweb/core/*/jobs/* -type f -exec chmod 750 {} \; && \
|
|
chmod 755 /usr/share/bunkerweb
|
|
|
|
# Copy Linux files
|
|
COPY src/linux/scripts /usr/share/bunkerweb/scripts
|
|
COPY src/linux/fpm.sh /usr/share/fpm.sh
|
|
RUN chmod +x /usr/share/bunkerweb/scripts/*.sh /usr/share/fpm.sh
|
|
COPY src/linux/fpm-debian /usr/share/.fpm
|
|
COPY src/linux/bunkerweb.service /lib/systemd/system/bunkerweb.service
|
|
COPY src/linux/bunkerweb-ui.service /lib/systemd/system/bunkerweb-ui.service
|
|
|
|
# Generate DEB at startup
|
|
VOLUME /data
|
|
WORKDIR /usr/share/
|
|
ENTRYPOINT ["/usr/share/fpm.sh", "deb"]
|