commit
e221729d95
30
Dockerfile
30
Dockerfile
@ -1,25 +1,11 @@
|
|||||||
FROM gitea/gitea:1.14.5-rootless
|
FROM gitea/gitea:1.14.5-rootless
|
||||||
ARG DATABASE_URL
|
|
||||||
ENV DATABASE_URL=${DATABASE_URL}
|
WORKDIR /app
|
||||||
COPY --chown=root:root run.sh /usr/local/bin/
|
|
||||||
ADD conf/ /var/lib/gitea/custom/conf/
|
COPY app_url.txt ./
|
||||||
|
COPY run.sh ./
|
||||||
|
|
||||||
USER root
|
USER root
|
||||||
RUN chmod 755 /usr/local/bin/run.sh
|
RUN chmod +x ./run.sh
|
||||||
RUN chmod a+rwx /var/lib/gitea/custom/conf/app.ini
|
|
||||||
|
|
||||||
USER 1000:1000
|
ENTRYPOINT ["./run.sh"]
|
||||||
|
|
||||||
CMD ["/usr/local/bin/run.sh"]
|
|
||||||
|
|
||||||
|
|
||||||
#FROM gitea/gitea:1.14.5
|
|
||||||
#
|
|
||||||
#WORKDIR /app
|
|
||||||
#
|
|
||||||
#COPY run.sh ./
|
|
||||||
#
|
|
||||||
#ENV GITEA_CUSTOM=/var/lib/gitea/custom
|
|
||||||
#
|
|
||||||
#RUN chmod +x ./run.sh
|
|
||||||
#
|
|
||||||
#ENTRYPOINT ["./run.sh"]
|
|
||||||
|
1
app_url.txt
Normal file
1
app_url.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
https://s464951-gitea-fa34820a73f7.herokuapp.com/
|
27
deploy.sh
Executable file
27
deploy.sh
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# App name
|
||||||
|
APP_NAME=s464951-gitea
|
||||||
|
|
||||||
|
heroku create --stack container --region eu $APP_NAME --json
|
||||||
|
APP_URL=$(heroku info -s | grep web_url | cut -d= -f2)
|
||||||
|
|
||||||
|
echo $APP_URL > app_url.txt
|
||||||
|
|
||||||
|
heroku addons:create heroku-postgresql:essential-0 --app $APP_NAME
|
||||||
|
|
||||||
|
echo "Waiting for Heroku Postgres to be fully provisioned..."
|
||||||
|
heroku pg:wait --app $APP_NAME
|
||||||
|
|
||||||
|
echo DB_URL
|
||||||
|
heroku config:get DATABASE_URL -a $APP_NAME
|
||||||
|
|
||||||
|
|
||||||
|
# Push to Heroku
|
||||||
|
heroku git:remote --app $APP_NAME
|
||||||
|
git add .
|
||||||
|
git commit -m "Deploy to Heroku"
|
||||||
|
git push heroku main
|
||||||
|
|
||||||
|
# Open the app in the browser
|
||||||
|
heroku open --app $APP_NAME
|
1
heroku-app.txt
Normal file
1
heroku-app.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
19
heroku.yml
19
heroku.yml
@ -1,23 +1,8 @@
|
|||||||
setup:
|
setup:
|
||||||
addons:
|
addons:
|
||||||
- plan: heroku-postgresql:standard-0
|
- plan: heroku-postgresql
|
||||||
as: DATABASE
|
as: DATABASE
|
||||||
|
|
||||||
build:
|
build:
|
||||||
docker:
|
docker:
|
||||||
web: Dockerfile
|
web: Dockerfile
|
||||||
run:
|
|
||||||
web: /usr/local/bin/run.sh
|
|
||||||
|
|
||||||
|
|
||||||
#setup:
|
|
||||||
# addons:
|
|
||||||
# - plan: heroku-postgresql
|
|
||||||
# as: DATABASE
|
|
||||||
## config:
|
|
||||||
## POSTGRES_USER: "gitea"
|
|
||||||
## POSTGRES_PASSWORD: "gitea"
|
|
||||||
## POSTGRES_DB: "gitea"
|
|
||||||
#
|
|
||||||
#build:
|
|
||||||
# docker:
|
|
||||||
# web: Dockerfile
|
|
||||||
|
57
run.sh
57
run.sh
@ -1,45 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
FILE=./app_url.txt
|
||||||
|
ROOT_URL=$(cat $FILE)
|
||||||
|
|
||||||
|
printf($ROOT_URL)
|
||||||
HOST=`echo $DATABASE_URL | grep -o "@.*/" | sed 's/.$//' | cut -c 2-`
|
HOST=`echo $DATABASE_URL | grep -o "@.*/" | sed 's/.$//' | cut -c 2-`
|
||||||
NAME=`echo $DATABASE_URL | grep -o "/[[:alnum:]]*$" | cut -c 2-`
|
NAME=`echo $DATABASE_URL | grep -o "/[[:alnum:]]*$" | cut -c 2-`
|
||||||
USER=`echo $DATABASE_URL | grep -o "//[[:alnum:]]*:" | grep -o "[[:alnum:]]*"`
|
USER=`echo $DATABASE_URL | grep -o "//[[:alnum:]]*:" | grep -o "[[:alnum:]]*"`
|
||||||
PASSWD=`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 "DOMAIN = $HEROKU_APP_DEFAULT_DOMAIN_NAME\n" >> /var/lib/gitea/custom/conf/app.ini
|
|
||||||
printf "\n[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
|
|
||||||
|
|
||||||
|
mkdir -p /var/lib/gitea/custom/conf
|
||||||
|
|
||||||
|
echo "[server]" > /var/lib/gitea/custom/conf/app.ini
|
||||||
|
echo "ROOT_URL = $ROOT_URL >> /var/lib/gitea/custom/conf/app.ini
|
||||||
|
|
||||||
##!/bin/bash
|
echo "[database]" >> /var/lib/gitea/custom/conf/app.ini
|
||||||
#
|
echo "DB_TYPE = postgres" >> /var/lib/gitea/custom/conf/app.ini
|
||||||
#
|
echo "HOST = $HOST" >> /var/lib/gitea/custom/conf/app.ini
|
||||||
#
|
echo "NAME = $NAME" >> /var/lib/gitea/custom/conf/app.ini
|
||||||
#echo $APP_URL
|
echo "USER = $USER" >> /var/lib/gitea/custom/conf/app.ini
|
||||||
#echo DATABASE_URL
|
echo "PASSWD = $PASSWD" >> /var/lib/gitea/custom/conf/app.ini
|
||||||
#echo $DATABASE_URL
|
echo "SSL_MODE = require" >> /var/lib/gitea/custom/conf/app.ini
|
||||||
#
|
|
||||||
#HOST=`echo $DATABASE_URL | grep -o "@.*/" | sed 's/.$//' | cut -c 2-`
|
/usr/local/bin/gitea web --port $PORT
|
||||||
#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:]]*"`
|
|
||||||
#
|
|
||||||
#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 = $HOST" >> /var/lib/gitea/custom/conf/app.ini
|
|
||||||
#echo "NAME = $NAME" >> /var/lib/gitea/custom/conf/app.ini
|
|
||||||
#echo "USER = $USER" >> /var/lib/gitea/custom/conf/app.ini
|
|
||||||
#echo "PASSWD = $PASSWD" >> /var/lib/gitea/custom/conf/app.ini
|
|
||||||
#echo "SSL_MODE = require" >> /var/lib/gitea/custom/conf/app.ini
|
|
||||||
#
|
|
||||||
#cat /var/lib/gitea/custom/conf/app.ini
|
|
||||||
#/usr/local/bin/gitea web --port $PORT
|
|
Loading…
Reference in New Issue
Block a user