mirror of
https://github.com/bunkerity/bunkerized-nginx
synced 2023-12-13 21:30:18 +01:00
Merge branch 'dev' of github.com:bunkerity/bunkerweb into dev
This commit is contained in:
commit
f1435f2312
4 changed files with 143 additions and 10 deletions
|
@ -19,6 +19,35 @@ 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 && \
|
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
|
rm -rf /tmp/req
|
||||||
|
|
||||||
|
# # Install dependencies
|
||||||
|
# RUN apt-get update && \
|
||||||
|
# apt-get install -y --no-install-recommends \
|
||||||
|
# wget \
|
||||||
|
# build-essential \
|
||||||
|
# libffi-dev \
|
||||||
|
# libgdbm-dev \
|
||||||
|
# libc6-dev \
|
||||||
|
# libssl-dev \
|
||||||
|
# zlib1g-dev \
|
||||||
|
# libbz2-dev \
|
||||||
|
# libreadline-dev \
|
||||||
|
# libsqlite3-dev \
|
||||||
|
# libncurses5-dev \
|
||||||
|
# libncursesw5-dev \
|
||||||
|
# xz-utils \
|
||||||
|
# tk-dev
|
||||||
|
|
||||||
|
# # Installing python3.11
|
||||||
|
# RUN wget https://www.python.org/ftp/python/3.11.4/Python-3.11.4.tgz && \
|
||||||
|
# tar xzf Python-3.11.4.tgz && \
|
||||||
|
# cd Python-3.11.4 && \
|
||||||
|
# ./configure --enable-optimizations && \
|
||||||
|
# make -j$(nproc) && \
|
||||||
|
# make altinstall && \
|
||||||
|
# rm -rf /usr/src/Python-3.11.4*
|
||||||
|
# # Installing pip
|
||||||
|
# RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.11
|
||||||
|
|
||||||
# Nginx
|
# Nginx
|
||||||
RUN apt-get install gnupg2 ca-certificates wget -y && \
|
RUN 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 https://nginx.org/packages/debian/ bullseye nginx" > /etc/apt/sources.list.d/nginx.list && \
|
||||||
|
@ -28,15 +57,15 @@ RUN apt-get install gnupg2 ca-certificates wget -y && \
|
||||||
apt-get install -y --no-install-recommends nginx=${NGINX_VERSION}-1~bullseye
|
apt-get install -y --no-install-recommends nginx=${NGINX_VERSION}-1~bullseye
|
||||||
|
|
||||||
# Compile and install dependencies
|
# Compile and install dependencies
|
||||||
RUN 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 && \
|
RUN apt install --no-install-recommends bash 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 && \
|
pip3.11 install --no-cache-dir --upgrade pip && \
|
||||||
pip install wheel && \
|
pip3.11 install wheel && \
|
||||||
#mkdir -p /usr/share/bunkerweb/deps && \
|
#mkdir -p /usr/share/bunkerweb/deps && \
|
||||||
chmod +x /tmp/bunkerweb/deps/install.sh && \
|
chmod +x /tmp/bunkerweb/deps/install.sh && \
|
||||||
bash /tmp/bunkerweb/deps/install.sh && \
|
bash /tmp/bunkerweb/deps/install.sh && \
|
||||||
mkdir /usr/share/bunkerweb/deps/python && \
|
mkdir /usr/share/bunkerweb/deps/python && \
|
||||||
export MAKEFLAGS="-j$(nproc)" && \
|
export MAKEFLAGS="-j$(nproc)" && \
|
||||||
pip install --no-cache-dir --require-hashes --target /usr/share/bunkerweb/deps/python -r /usr/share/bunkerweb/deps/requirements.txt
|
pip3.11 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
|
# 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
|
#RUN pip install --no-deps --no-cache-dir --require-hashes --target /usr/share/bunkerweb/deps/python -r /tmp/bunkerweb/deps/requirements.txt
|
||||||
|
|
|
@ -19,6 +19,37 @@ 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 && \
|
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
|
rm -rf /tmp/req
|
||||||
|
|
||||||
|
# # Install dependencies
|
||||||
|
# RUN apt-get update -y && \
|
||||||
|
# DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||||
|
# wget \
|
||||||
|
# build-essential \
|
||||||
|
# checkinstall \
|
||||||
|
# libgdbm-dev \
|
||||||
|
# libc6-dev \
|
||||||
|
# libssl-dev \
|
||||||
|
# zlib1g-dev \
|
||||||
|
# libbz2-dev \
|
||||||
|
# libreadline-dev \
|
||||||
|
# libsqlite3-dev \
|
||||||
|
# libncurses5-dev \
|
||||||
|
# libncursesw5-dev \
|
||||||
|
# xz-utils \
|
||||||
|
# tk-dev \
|
||||||
|
# libffi-dev \
|
||||||
|
# tzdata
|
||||||
|
|
||||||
|
# # Installing python3.11
|
||||||
|
# RUN wget https://www.python.org/ftp/python/3.11.4/Python-3.11.4.tgz && \
|
||||||
|
# tar xzf Python-3.11.4.tgz && \
|
||||||
|
# cd Python-3.11.4 && \
|
||||||
|
# ./configure --enable-optimizations && \
|
||||||
|
# make -j$(nproc) && \
|
||||||
|
# make altinstall && \
|
||||||
|
# rm -rf /usr/src/Python-3.11.4*
|
||||||
|
# # Installing pip
|
||||||
|
# RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.11
|
||||||
|
|
||||||
# Nginx
|
# Nginx
|
||||||
RUN apt update && \
|
RUN apt update && \
|
||||||
apt-get install curl gnupg2 ca-certificates lsb-release ubuntu-keyring software-properties-common -y && \
|
apt-get install curl gnupg2 ca-certificates lsb-release ubuntu-keyring software-properties-common -y && \
|
||||||
|
@ -29,15 +60,15 @@ RUN apt update && \
|
||||||
apt-get install -y --no-install-recommends nginx=${NGINX_VERSION}-1~jammy
|
apt-get install -y --no-install-recommends nginx=${NGINX_VERSION}-1~jammy
|
||||||
|
|
||||||
# Compile and install dependencies
|
# Compile and install dependencies
|
||||||
RUN 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 && \
|
RUN apt install --no-install-recommends bash 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 && \
|
pip3.11 install --no-cache-dir --upgrade pip && \
|
||||||
pip install wheel && \
|
pip3.11 install wheel && \
|
||||||
#mkdir -p /usr/share/bunkerweb/deps && \
|
#mkdir -p /usr/share/bunkerweb/deps && \
|
||||||
chmod +x /tmp/bunkerweb/deps/install.sh && \
|
chmod +x /tmp/bunkerweb/deps/install.sh && \
|
||||||
bash /tmp/bunkerweb/deps/install.sh && \
|
bash /tmp/bunkerweb/deps/install.sh && \
|
||||||
mkdir /usr/share/bunkerweb/deps/python && \
|
mkdir /usr/share/bunkerweb/deps/python && \
|
||||||
export MAKEFLAGS="-j$(nproc)" && \
|
export MAKEFLAGS="-j$(nproc)" && \
|
||||||
pip install --no-cache-dir --require-hashes --target /usr/share/bunkerweb/deps/python -r /usr/share/bunkerweb/deps/requirements.txt
|
pip3.11 install --no-cache-dir --require-hashes --target /usr/share/bunkerweb/deps/python -r /usr/share/bunkerweb/deps/requirements.txt
|
||||||
|
|
||||||
# Copy files
|
# Copy files
|
||||||
# can't exclude deps from . so we are copying everything by hand
|
# can't exclude deps from . so we are copying everything by hand
|
||||||
|
@ -86,4 +117,4 @@ COPY src/linux/bunkerweb-ui.service /lib/systemd/system/bunkerweb-ui.service
|
||||||
# Generate DEB at startup
|
# Generate DEB at startup
|
||||||
VOLUME /data
|
VOLUME /data
|
||||||
WORKDIR /usr/share/
|
WORKDIR /usr/share/
|
||||||
ENTRYPOINT ["/usr/share/fpm.sh", "deb"]
|
ENTRYPOINT ["/usr/share/fpm.sh", "deb"]
|
|
@ -5,7 +5,7 @@ After=bunkerweb.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Restart=no
|
Restart=no
|
||||||
User=nginx
|
User=root
|
||||||
PIDFile=/var/run/bunkerweb/ui.pid
|
PIDFile=/var/run/bunkerweb/ui.pid
|
||||||
ExecStart=/usr/share/bunkerweb/scripts/bunkerweb-ui.sh start
|
ExecStart=/usr/share/bunkerweb/scripts/bunkerweb-ui.sh start
|
||||||
ExecStop=/usr/share/bunkerweb/scripts/bunkerweb-ui.sh stop
|
ExecStop=/usr/share/bunkerweb/scripts/bunkerweb-ui.sh stop
|
||||||
|
|
73
tests/linux/Linux.sh
Executable file
73
tests/linux/Linux.sh
Executable file
|
@ -0,0 +1,73 @@
|
||||||
|
# Small code to build and run the tests on Linux with docker
|
||||||
|
|
||||||
|
# Check if the package already exists in /tmp/$DISTRO/bunkerweb.deb or /tmp/$DISTRO/bunkerweb.rpm
|
||||||
|
# Always remove the package before building it
|
||||||
|
|
||||||
|
function checkPackage() {
|
||||||
|
if [ ! -z "$DISTRO" ]; then
|
||||||
|
if [ -f "/tmp/$DISTRO/bunkerweb.deb" ]; then
|
||||||
|
sudo rm -rf /tmp/$DISTRO/bunkerweb.deb
|
||||||
|
fi
|
||||||
|
if [ -f "/tmp/$DISTRO/bunkerweb.rpm" ]; then
|
||||||
|
sudo rm -rf /tmp/$DISTRO/bunkerweb.rpm
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Build the package using the dockerfile
|
||||||
|
|
||||||
|
function buildPackage() {
|
||||||
|
if [ ! -z "$DISTRO" ]; then
|
||||||
|
if [ "$DISTRO" = "ubuntu" ]; then
|
||||||
|
sudo docker build -t linux-ubuntu -f src/linux/Dockerfile-ubuntu .
|
||||||
|
fi
|
||||||
|
if [ "$DISTRO" = "debian" ]; then
|
||||||
|
sudo docker build -t linux-debian -f src/linux/Dockerfile-debian .
|
||||||
|
fi
|
||||||
|
if [ "$DISTRO" = "centos" ]; then
|
||||||
|
sudo docker build -t linux-centos -f src/linux/Dockerfile-centos .
|
||||||
|
fi
|
||||||
|
if [ "$DISTRO" = "fedora" ]; then
|
||||||
|
sudo docker build -t linux-fedora -f src/linux/Dockerfile-fedora .
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create the container and copy the package to the host
|
||||||
|
|
||||||
|
function createContainer() {
|
||||||
|
if [ ! -z "$DISTRO" ]; then
|
||||||
|
if [ "$DISTRO" = "ubuntu" ]; then
|
||||||
|
sudo docker run -v /tmp/ubuntu:/data linux-ubuntu
|
||||||
|
fi
|
||||||
|
if [ "$DISTRO" = "debian" ]; then
|
||||||
|
sudo docker run -v /tmp/debian:/data linux-debian
|
||||||
|
fi
|
||||||
|
if [ "$DISTRO" = "centos" ]; then
|
||||||
|
sudo docker run -v /tmp/centos:/data linux-centos
|
||||||
|
fi
|
||||||
|
if [ "$DISTRO" = "fedora" ]; then
|
||||||
|
sudo docker run -v /tmp/fedora:/data linux-fedora
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Retrieve $DISTRO from the user
|
||||||
|
|
||||||
|
function retrieveDistro() {
|
||||||
|
echo "Which distro do you want to use? (ubuntu, debian, centos, fedora)"
|
||||||
|
read DISTRO
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main function
|
||||||
|
|
||||||
|
function main() {
|
||||||
|
retrieveDistro
|
||||||
|
checkPackage
|
||||||
|
buildPackage
|
||||||
|
createContainer
|
||||||
|
}
|
||||||
|
|
||||||
|
main
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue