From 9cc4e80c305142a743afdf38846e282dd6068e4c Mon Sep 17 00:00:00 2001 From: Alexandre Blanco Gomez Date: Fri, 12 Sep 2025 11:14:36 +0200 Subject: [PATCH] Migrate from gitea --- .dockerignore | 27 +++++++++++++++++++++++ .gitignore | 1 + Dockerfile | 43 ++++++++++++++++++++++++++++++++++++ lighttpd.conf | 58 +++++++++++++++++++++++++++++++++++++++++++++++++ service-menu.sh | 2 ++ 5 files changed, 131 insertions(+) create mode 100644 .dockerignore create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 lighttpd.conf create mode 100644 service-menu.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..0b1e1e7 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,27 @@ +**/__pycache__ +**/.venv +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/bin +**/charts +**/docker-compose* +**/compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dbe9c82 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.vscode/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f5420ee --- /dev/null +++ b/Dockerfile @@ -0,0 +1,43 @@ +# For more information, please refer to https://aka.ms/vscode-docker-python +# Use the official Nginx image from Docker Hub +FROM debian:bookworm-slim + +# Copy static files (optional) +#COPY html/ /usr/share/nginx/html/ + +# Expose ports (default is 80 for HTTP and 443 for HTTPS) +EXPOSE 80 + +# Keeps Python from generating .pyc files in the container +ENV PYTHONDONTWRITEBYTECODE=1 + +# Turns off buffering for easier container logging +ENV PYTHONUNBUFFERED=1 + +RUN apt-get update + +RUN apt-get install -y --no-install-recommends python3-pip + +RUN apt-get install -y --no-install-recommends systemctl procps +RUN apt-get install -y --no-install-recommends lighttpd + +RUN lighty-enable-mod cgi + +# Copy custom configuration file (optional) +COPY lighttpd.conf /etc/lighttpd/lighttpd.conf +COPY service-menu.sh /var/www/html/service-menu.sh + +RUN pip install bscpylgtv --break-system-packages + +CMD ["/bin/bash", "systemctl start lighttpd"] + +#WORKDIR /app +#COPY . /app + +# Creates a non-root user with an explicit UID and adds permission to access the /app folder +# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers +#RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app +#USER appuser + +# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug +#CMD ["python", "-m", "myapp.manage"] diff --git a/lighttpd.conf b/lighttpd.conf new file mode 100644 index 0000000..f1b3a63 --- /dev/null +++ b/lighttpd.conf @@ -0,0 +1,58 @@ +server.modules = ( + "mod_indexfile", + "mod_access", + "mod_alias", + "mod_redirect", +) + +server.document-root = "/var/www/html" +server.upload-dirs = ( "/var/cache/lighttpd/uploads" ) +server.errorlog = "/var/log/lighttpd/error.log" +server.pid-file = "/run/lighttpd.pid" +server.username = "www-data" +server.groupname = "www-data" +server.port = 80 + +# features +#https://redmine.lighttpd.net/projects/lighttpd/wiki/Server_feature-flagsDetails +server.feature-flags += ("server.h2proto" => "enable") +server.feature-flags += ("server.h2c" => "enable") +server.feature-flags += ("server.graceful-shutdown-timeout" => 5) +#server.feature-flags += ("server.graceful-restart-bg" => "enable") + +# strict parsing and normalization of URL for consistency and security +# https://redmine.lighttpd.net/projects/lighttpd/wiki/Server_http-parseoptsDetails +# (might need to explicitly set "url-path-2f-decode" = "disable" +# if a specific application is encoding URLs inside url-path) +server.http-parseopts = ( + "header-strict" => "enable",# default + "host-strict" => "enable",# default + "host-normalize" => "enable",# default + "url-normalize-unreserved"=> "enable",# recommended highly + "url-normalize-required" => "enable",# recommended + "url-ctrls-reject" => "enable",# recommended + "url-path-2f-decode" => "enable",# recommended highly (unless breaks app) + #"url-path-2f-reject" => "enable", + "url-path-dotseg-remove" => "enable",# recommended highly (unless breaks app) + #"url-path-dotseg-reject" => "enable", + #"url-query-20-plus" => "enable",# consistency in query string +) + +index-file.names = ( "index.php", "index.html" ) +url.access-deny = ( "~", ".inc" ) +static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" ) + +# default listening port for IPv6 falls back to the IPv4 port +include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port +include_shell "/usr/share/lighttpd/create-mime.conf.pl" +include "/etc/lighttpd/conf-enabled/*.conf" + +#server.compat-module-load = "disable" +server.modules += ( + "mod_dirlisting", + "mod_staticfile", +) + +cgi.assign = ( +"/service-menu.sh" => "/bin/bash" +) \ No newline at end of file diff --git a/service-menu.sh b/service-menu.sh new file mode 100644 index 0000000..d820102 --- /dev/null +++ b/service-menu.sh @@ -0,0 +1,2 @@ +#!/bin/bash +bscpylgtvcommand 192.168.0.3 button IN_START \ No newline at end of file