This commit is contained in:
Sheaza 2024-10-28 21:17:14 +01:00
commit 4c8501c369
5 changed files with 36 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/venv
.idea

12
Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM gitea/gitea:1.14.5-rootless
ARG DATABASE_URL
ENV DATABASE_URL=${DATABASE_URL}
COPY --chown=root:root run.sh /usr/local/bin/
ADD ../heroku-gitea/conf/ /var/lib/gitea/custom/conf/
USER root
RUN chmod 755 /usr/local/bin/run.sh
RUN chmod a+rwx /var/lib/gitea/custom/conf/app.ini
USER 1000:1000
CMD ["/usr/local/bin/run.sh"]

0
conf/app.ini Normal file
View File

9
heroku.yml Normal file
View File

@ -0,0 +1,9 @@
setup:
addons:
- plan: heroku-postgresql
as: DATABASE
build:
docker:
web: Dockerfile
run:
web: /usr/local/bin/run.sh

13
run.sh Normal file
View File

@ -0,0 +1,13 @@
HOST=`echo $DATABASE_URL | grep -o "@.*/" | sed 's/.$//' | cut -c 2-`
NAME=`echo $DATABASE_URL | grep -o "/[[:alnum:]]*$" | cut -c 2-`
USER=`echo $DATABASE_URL | grep -o "//[[:alnum:]]*:" | grep -o "[[:alnum:]]*"`
PASSWD=`echo $DATABASE_URL | grep -o ":[[:alnum:]]*@" | grep -o "[[:alnum:]]*"`
printf "[server]\nHTTP_PORT = $PORT;\n" > /var/lib/gitea/custom/conf/app.ini
printf "[database]\nDB_TYPE = postgres;\n" >> /var/lib/gitea/custom/conf/app.ini
printf "NAME = $NAME;\n" >> /var/lib/gitea/custom/conf/app.ini
printf "HOST = $HOST;\n" >> /var/lib/gitea/custom/conf/app.ini
printf "USER = $USER;\n" >> /var/lib/gitea/custom/conf/app.ini
printf "PASSWD = $PASSWD;\n" >> /var/lib/gitea/custom/conf/app.ini
printf "SSL_MODE = require ;\n" >> /var/lib/gitea/custom/conf/app.ini
cat /var/lib/gitea/custom/conf/app.ini
/usr/local/bin/gitea web -port $PORT