From 273de552dbe2fe014ef8851acd0d85834b8d5087 Mon Sep 17 00:00:00 2001 From: awieczarek Date: Sun, 20 Oct 2024 15:22:00 +0200 Subject: [PATCH] Test --- Dockerfile | 9 +-------- parse_db_url.sh | 8 ++++++++ 2 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 parse_db_url.sh diff --git a/Dockerfile b/Dockerfile index 1768278..8ed2bb2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,13 +6,6 @@ ADD data /var/lib/gitea ADD localtime /etc/localtime ADD timezone /etc/timezone - -RUN echo '#!/bin/sh' > /parse_db_url.sh && \ - echo 'export GITEA__database__DB_TYPE=${DATABASE_URL%%:*}' >> /parse_db_url.sh && \ - echo 'export GITEA__database__USER=$(echo ${DATABASE_URL} | sed -r "s|.*://([^:]+):.*|\1|")' >> /parse_db_url.sh && \ - echo 'export GITEA__database__PASSWD=$(echo ${DATABASE_URL} | sed -r "s|.*://[^:]+:([^@]+)@.*|\1|")' >> /parse_db_url.sh && \ - echo 'export GITEA__database__HOST=$(echo ${DATABASE_URL} | sed -r "s|.*@([^:]+):.*|\1|")' >> /parse_db_url.sh && \ - echo 'export GITEA__database__NAME=$(echo ${DATABASE_URL} | sed -r "s|.*:([0-9]+)/([^?]+).*|\2|")' >> /parse_db_url.sh && \ - chmod +x /parse_db_url.sh +COPY parse_db_url.sh /usr/local/bin/parse_db_url.sh ENTRYPOINT ["/bin/sh", "-c", "/parse_db_url.sh && /usr/local/bin/gitea web -port $PORT"] diff --git a/parse_db_url.sh b/parse_db_url.sh new file mode 100644 index 0000000..3836d4c --- /dev/null +++ b/parse_db_url.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +export GITEA__database__DB_TYPE=${DATABASE_URL%%:*} +export GITEA__database__USER=$(echo ${DATABASE_URL} | sed -r "s|.*://([^:]+):.*|\1|") +export GITEA__database__PASSWD=$(echo ${DATABASE_URL} | sed -r "s|.*://[^:]+:([^@]+)@.*|\1|") +export GITEA__database__HOST=$(echo ${DATABASE_URL} | sed -r "s|.*@([^:]+):.*|\1|") +export GITEA__database__NAME=$(echo ${DATABASE_URL} | sed -r "s|.*:([0-9]+)/([^?]+).*|\2|") +