librex/Dockerfile

92 lines
4.8 KiB
Docker
Raw Normal View History

2023-02-11 19:54:45 -03:00
# syntax=docker/dockerfile:1
ARG VERSION="3.17"
FROM alpine:${VERSION} AS runner
WORKDIR "/home/librex"
# Docker metadata contains information about the maintainer, such as the name, repository, and support email
# Please add any necessary information or correct any incorrect information
# See more: https://docs.docker.com/config/labels-custom-metadata/
LABEL name="LibreX" \
description="Framework and javascript free privacy respecting meta search engine" \
version="1.0" \
vendor="Hnhx Femboy<femboy.hu>" \
url="https://github.com/hnhx/librex" \
usage="https://github.com/hnhx/librex/wiki" \
authors="https://github.com/hnhx/librex/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
2023-02-11 19:18:04 -03:00
ARG DOCKER_SCRIPTS="docker"
# 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="America/New_York"
# Configure 'opensearch.xml' with Librex configuration metadata, such as the encoding and the host that stores the site
# These configurations will replace the 'opensearch.xml' inside '.dockers/templates' for the best setup for your instance
ENV OPEN_SEARCH_TITLE="LibreX"
ENV OPEN_SEARCH_DESCRIPTION="Framework and javascript free privacy respecting meta search engine"
ENV OPEN_SEARCH_ENCODING="UTF-8"
ENV OPEN_SEARCH_LONG_NAME="LibreX Search"
ENV OPEN_SEARCH_HOST="http://localhost:80"
# Replace the 'config.php' script, which contains the most common search engine configurations, with these environment setups
# These environment setups can be found in 'config.php', and the default configurations can be useful for most use cases
ENV CONFIG_GOOGLE_DOMAIN=".com"
ENV CONFIG_GOOGLE_LANGUAGUE="en"
ENV CONFIG_INVIDIOUS_INSTANCE="invidious.namazso.eu"
ENV CONFIG_HIDDEN_SERVICE_SEARCH=false
ENV CONFIG_DISABLE_BITTORRENT_SEARCH=false
ENV CONFIG_BITTORRENT_TRACKERS="&tr=http://nyaa.tracker.wf:7777/announce&tr=udp://open.stealth.si:80/announce&tr=udp://tracker.opentrackr.org:1337/announce&tr=udp://exodus.desync.com:6969/announce&tr=udp://tracker.torrent.eu.org:451/announce"
# Supported apps integration configuration. These empty spaces can be set up using free hosts as pointers
# A particular example is using the "https://yewtu.be" or a self-hosted host to integrate the invidious app to librex
ENV APP_INVIDIOUS=""
ENV APP_BIBLIOGRAM=""
ENV APP_RIMGO=""
ENV APP_SCRIBE=""
ENV APP_LIBRARIAN=""
ENV APP_GOTHUB=""
ENV APP_NITTER=""
ENV APP_LIBREREDDIT=""
ENV APP_PROXITOK=""
ENV APP_WIKILESS=""
ENV APP_QUETRE=""
ENV APP_LIBREMDB=""
ENV APP_BREEZEWIKI=""
ENV APP_ANONYMOUS_OVERFLOW=""
# GNU/Curl configurations. Leave 'CURLOPT_PROXY' blank whether you don't need to use a proxy for requests
# Generally, a proxy is needed when your IP address is blocked by search engines in response to multiple requests within a short time frame. In these cases, it is recommended to use rotating proxies
ENV CURLOPT_PROXY_ENABLED=false
ENV CURLOPT_PROXY=""
ENV CURLOPT_RETURNTRANSFER=true
ENV CURLOPT_ENCODING=""
ENV CURLOPT_USERAGENT="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36"
ENV CURLOPT_CUSTOMREQUEST="GET"
ENV CURLOPT_MAXREDIRS=5
ENV CURLOPT_TIMEOUT=18
ENV CURLOPT_VERBOSE=false
# Include docker scripts, docker images, and the 'GNU License' in the Librex container
ADD "${DOCKER_SCRIPTS}/*" "scripts/"
ADD "." "."
# Set permissions for script files as executable scripts inside 'docker/scripts' directory
RUN chmod u+x "scripts/entrypoint.sh" &&\
chmod u+x "scripts/prepare.sh"
# Add 'zip' package to generate a temporary compressed 'librex.zip' for best recursive copy between Docker images
# Remove unnecessary folders and create a temporary folder that will contain the zip file created earlier
# Compress Librex files, excluding the '.docker' folder containing scripts and the Dockerfile, using the previously downloaded zip package
# Delete all files in the root directory, except for the '.docker' and 'tmp' folders, which are created exclusively to be handled by Docker
RUN apk update; apk add zip abuild-rootbld --no-cache &&\
rm -rf .git; mkdir -p "tmp/zip"; mkdir -p "scripts/tmp" &&\
zip -r "tmp/zip/librex.zip" . -x "scripts/**\*" "Dockerfile\*" &&\
find -maxdepth 1 ! -name "scripts" ! -name "tmp" ! -name "templates" ! -name "." -exec rm -rv {} \; &&\
sh -c 'scripts/prepare.sh' && apk del -r zip abuild-rootbld
# Configures the container to be run as an executable.
ENTRYPOINT ["/bin/sh", "-c", "scripts/entrypoint.sh --images=nginx/php"]