commit 92729c26e0095adb884c63dd713c1c04a8961d80 Author: root Date: Thu Oct 24 21:13:36 2024 +0200 inital diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2474457 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM gitea/gitea:1.14.5 + +WORKDIR /app + +COPY app_link.txt ./ +COPY conf_script.sh ./ + +RUN chmod +x ./conf_script.sh + +ENTRYPOINT ["./conf_script.sh"] + diff --git a/app_link.txt b/app_link.txt new file mode 100644 index 0000000..79a545c --- /dev/null +++ b/app_link.txt @@ -0,0 +1 @@ +https://zad-1-2-464953-df1863c4e844.herokuapp.com/ diff --git a/conf_script.sh b/conf_script.sh new file mode 100644 index 0000000..a82ee22 --- /dev/null +++ b/conf_script.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +if [ -z "$HEROKU_APP_NAME" ]; then + echo "HEROKU_APP_NAME is not set. Exiting." + exit 1 +fi + +if [[ $DATABASE_URL =~ ^postgres://([^:]+):([^@]+)@([^:]+):([0-9]+)/([^/]+)$ ]]; then + DB_USER="${BASH_REMATCH[1]}" + DB_PASS="${BASH_REMATCH[2]}" + DB_HOST="${BASH_REMATCH[3]}:${BASH_REMATCH[4]}" + DB_NAME="${BASH_REMATCH[5]}" +else + echo "DATABASE_URL parse error" + exit 1 +fi + +APP_URL=$(< /app/app_link.txt) +APP_URL2="https://${HEROKU_APP_NAME}.herokuapp.com/" +echo $APP_URL2 + +mkdir -p /var/lib/gitea/custom/conf + +echo "[server]" > /var/lib/gitea/custom/conf/app.ini +echo "ROOT_URL = $APP_URL" >> /var/lib/gitea/custom/conf/app.ini + +echo "[database]" >> /var/lib/gitea/custom/conf/app.ini +echo "DB_TYPE = postgres" >> /var/lib/gitea/custom/conf/app.ini +echo "HOST = $DB_HOST" >> /var/lib/gitea/custom/conf/app.ini +echo "NAME = $DB_NAME" >> /var/lib/gitea/custom/conf/app.ini +echo "USER = $DB_USER" >> /var/lib/gitea/custom/conf/app.ini +echo "PASSWD = $DB_PASS" >> /var/lib/gitea/custom/conf/app.ini +echo "SSL_MODE = require" >> /var/lib/gitea/custom/conf/app.ini + +/usr/local/bin/gitea web --port $PORT + diff --git a/heroku.yml b/heroku.yml new file mode 100644 index 0000000..60e00e2 --- /dev/null +++ b/heroku.yml @@ -0,0 +1,7 @@ +setup: + addons: + - plan: heroku-postgresql:standard-0 + as: DATABASE +build: + docker: + web: Dockerfile