From 2a3ab3a19eefbdb15da281176b35a8d3b85cfb12 Mon Sep 17 00:00:00 2001 From: Revvy Date: Mon, 9 Oct 2023 07:38:55 -0400 Subject: [PATCH 1/2] make docker better --- .dockerignore | 7 +++++ Dockerfile | 53 ++++++++++--------------------------- docker-build.sh | 5 ---- docker-compose.example.yaml | 7 ----- docker-compose.yml | 7 +++++ nginx.conf | 23 +++++++++++----- 6 files changed, 44 insertions(+), 58 deletions(-) create mode 100644 .dockerignore delete mode 100644 docker-build.sh delete mode 100644 docker-compose.example.yaml create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..7e8ecce --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +.github/ +.git/ +.gitignore +.dockerignore +docker-compose.yml +Dockerfile +README.md diff --git a/Dockerfile b/Dockerfile index 3ee2bcc..9b888c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,42 +1,17 @@ -FROM alpine:3.18 +FROM nginx:mainline-alpine-slim -WORKDIR "/var/www/html" +RUN apk add php82 php82-fpm php82-dom php82-curl php82-json php82-openssl --no-cache +RUN sed -i 's/user nginx;/user nobody;/' /etc/nginx/nginx.conf \ + && sed -i 's/listen = 127.0.0.1:9000/listen = \/run\/php-fpm82.sock/' /etc/php82/php-fpm.d/www.conf \ + && sed -i 's/;listen.owner/listen.owner/' /etc/php82/php-fpm.d/www.conf \ + && sed -i 's/;listen.group/listen.group/' /etc/php82/php-fpm.d/www.conf \ + && sed -i 's/;listen.mode/listen.mode/' /etc/php82/php-fpm.d/www.conf \ + && sed -i 's/;listen.allowed_clients/listen.allowed_clients/' /etc/php82/php-fpm.d/www.conf -ADD "." "." +RUN mkdir -p /var/www/binternet +COPY . /var/www/binternet +COPY nginx.conf /etc/nginx/conf.d/binternet.conf +RUN rm /var/www/binternet/nginx.conf /etc/nginx/conf.d/default.conf -# Docker metadata contains information about the maintainer, such as the name, repository, and support email -# See more: https://docs.docker.com/config/labels-custom-metadata/ -LABEL name="Binternet" \ - description="A custom Pinterest frontend, made in PHP." \ - version="1.0" \ - vendor="Ahwx " \ - maintainer="Ahwx " \ - url="https://github.com/Ahwxorg/LibreY" \ - authors="https://github.com/Ahwxorg/LibreY/contributors" - -# Include arguments as temporary environment variables to be handled by Docker during the image build process -# Change or add new arguments to customize the image generated by 'docker build' command -ARG DOCKER_SCRIPTS="docker" -ARG NGINX_PORT=8009 -# Set this argument during build time to indicate that the path is for php's www.conf -ARG WWW_CONFIG="/etc/php82/php-fpm.d/www.conf" - -# Customize the environment during both execution and build time by modifying the environment variables added to the container's shell -# When building your image, make sure to set the 'TZ' environment variable to your desired time zone location, for example 'America/Sao_Paulo' -# See more: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List -ENV TZ="Europe/Amsterdam" - -# Install required packages -RUN apk add gettext php82 php82-fpm php82-dom php82-curl php82-json nginx --no-cache - -# Configure PHP-FPM to listen on a Unix socket instead of a TCP port, which is more secure and efficient -RUN touch /run/php-fpm82.sock && chown nginx:nginx "/run/php-fpm82.sock" -RUN sed -i 's/^\s*listen = 127.0.0.1:9000/listen = \/run\/php-fpm82.sock/' ${WWW_CONFIG} &&\ - sed -i 's/^\s*;\s*listen.owner = nobody/listen.owner = nginx/' ${WWW_CONFIG} &&\ - sed -i 's/^\s*;\s*listen.group = nobody/listen.group = nginx/' ${WWW_CONFIG} &&\ - sed -i 's/^\s*;\s*listen.mode = 0660/listen.mode = 0660/' ${WWW_CONFIG} - -EXPOSE ${NGINX_PORT} - -# Configures the container to be run as an executable. -ENTRYPOINT ["/bin/sh", "-c", "docker/entrypoint.sh"] +EXPOSE 80 +ENTRYPOINT ["/bin/sh", "-c" , "/usr/sbin/php-fpm82 -D && /usr/sbin/nginx -c /etc/nginx/nginx.conf -g 'daemon off;'"] diff --git a/docker-build.sh b/docker-build.sh deleted file mode 100644 index 49b5c43..0000000 --- a/docker-build.sh +++ /dev/null @@ -1,5 +0,0 @@ -echo Version? -read -r VERSION -docker build -t binternet:$VERSION . && docker tag binternet:$VERSION ahwx/binternet:$VERSION && docker push ahwx/binternet:$VERSION - -docker build -t binternet:latest . && docker tag binternet:latest ahwx/binternet:latest && docker push ahwx/binternet:latest diff --git a/docker-compose.example.yaml b/docker-compose.example.yaml deleted file mode 100644 index 97007ab..0000000 --- a/docker-compose.example.yaml +++ /dev/null @@ -1,7 +0,0 @@ -version: '3.3' -services: - binternet: - ports: - - '8015:8009' - container_name: binternet - image: 'ghcr.io/ahwxorg/binternet:latest' diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7c0286e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +version: '3.3' +services: + binternet: + container_name: binternet + image: ghcr.io/ahwxorg/binternet:latest + ports: + - '8080:80' diff --git a/nginx.conf b/nginx.conf index bc5cb2e..ff33aa9 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,11 +1,20 @@ server { - listen 8009; + listen 80 default_server; + server_name _; - root /var/www/html/binternet; - index index.php; + root /var/www/binternet; + index index.php; - location ~ \.php$ { - include snippets/fastcgi-php.conf; - fastcgi_pass unix:/run/php/php7.4-fpm.sock; - } + location ~ \.php$ { + fastcgi_pass unix:/run/php-fpm82.sock; + fastcgi_index index.php; + fastcgi_param PATH_INFO $path_info; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + try_files $fastcgi_script_name =404; + set $path_info $fastcgi_path_info; + + include fastcgi_params; + } } From 7e05853a52a4e71658d3886162e6e45639106bb4 Mon Sep 17 00:00:00 2001 From: Revvy Date: Mon, 9 Oct 2023 07:43:15 -0400 Subject: [PATCH 2/2] dead instances, reorder --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 321a3ab..e17af2b 100644 --- a/README.md +++ b/README.md @@ -35,11 +35,9 @@ |-|-|-|-| | [binternet.ahwx.org](https://binternet.ahwx.org/) | no | no | 🇳🇱 NL (Official Instance) | | [binternet.revvy.de](https://binternet.revvy.de/) | [yes!](http://binternet.revvybrr6pvbx4n3j4475h4ghw4elqr4t5xo2vtd3gfpu2nrsnhh57id.onion/) | [yes!](http://revznkqdwy7nmlzql66x226g3qnapiooss3rg2uajbj4rypxjnba.b32.i2p/) | 🇨🇦 CA | +| no clearnet address | [yes!](http://binternet.skunky7dhv7nohsoalpwe3sxfz3fbkad7r3wk632riye25vqm3meqead.onion/) | [yes!](http://5cv2aw6jhe6la444vpn3jvo46442ls3ccgp3difx5ddlv5yf4hlq.b32.i2p/) | 🇷🇺 RU | | [binternet.bloatcat.tk](https://binternet.bloatcat.tk/) | no | no | 🇮🇸 IS | -| [bn.vern.cc](https://bn.vern.cc) | [yes!](http://bn.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion/) | [yes!](http://verne3vnw4i3qffozcjygtnv4uedwedtevxe7aoht7fngduuwcpa.b32.i2p/) | 🇺🇸 US | -| [pinterest.foxhaven.cyou](https://pinterest.foxhaven.cyou) | no | no | 🇵🇱 PL | | [bn.opnxng.com](https://bn.opnxng.com) | no | no | 🇸🇬 SG | -| no clearnet addres | [yes!](http://binternet.skunky7dhv7nohsoalpwe3sxfz3fbkad7r3wk632riye25vqm3meqead.onion/) | [yes!](http://5cv2aw6jhe6la444vpn3jvo46442ls3ccgp3difx5ddlv5yf4hlq.b32.i2p/) | 🇷🇺 RU |