New postgres solution
This commit is contained in:
parent
f30f320269
commit
181ddd958a
24
Dockerfile
24
Dockerfile
@ -1,25 +1,9 @@
|
|||||||
FROM gitea/gitea:1.14.5-rootless
|
FROM gitea/gitea:1.14.5-rootless
|
||||||
|
|
||||||
ENV GITEA_CUSTOM=/var/lib/gitea/custom
|
RUN chmod a+rwx /var/lib/gitea/custom/conf/app.ini
|
||||||
|
|
||||||
RUN DATABASE_USER=$(echo $DATABASE_URL | cut -d ':' -f 2 | cut -d '/' -f 3) \
|
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||||
&& DATABASE_PASSWORD=$(echo $DATABASE_URL | cut -d ':' -f 3 | cut -d '@' -f 1) \
|
|
||||||
&& DATABASE_HOST=$(echo $DATABASE_URL | cut -d '@' -f 2 | cut -d ':' -f 1) \
|
|
||||||
&& DATABASE_PORT=$(echo $DATABASE_URL | cut -d ':' -f 4 | cut -d '/' -f 1) \
|
|
||||||
&& DATABASE_NAME=$(echo $DATABASE_URL | cut -d '/' -f 4) \
|
|
||||||
&& export GITEA__database__USER=$DATABASE_USER \
|
|
||||||
&& export GITEA__database__PASSWD=$DATABASE_PASSWORD \
|
|
||||||
&& export GITEA__database__HOST=$DATABASE_HOST \
|
|
||||||
&& export GITEA__database__NAME=$DATABASE_NAME \
|
|
||||||
&& export GITEA__database__DB_TYPE=postgres \
|
|
||||||
&& export GITEA__database__SSL_MODE=require
|
|
||||||
|
|
||||||
ENV GITEA__database__USER=$DATABASE_USER \
|
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||||
GITEA__database__PASSWD=$DATABASE_PASSWORD \
|
|
||||||
GITEA__database__HOST=$DATABASE_HOST \
|
|
||||||
GITEA__database__NAME=$DATABASE_NAME \
|
|
||||||
GITEA__database__DB_TYPE=postgres \
|
|
||||||
GITEA__database__SSL_MODE=require
|
|
||||||
|
|
||||||
COPY app.ini /var/lib/gitea/custom/conf/app.ini
|
|
||||||
|
|
||||||
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||||
|
18
config.sh
Normal file
18
config.sh
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Extract values from DATABASE_URL
|
||||||
|
DATABASE_USER=$(echo $DATABASE_URL | cut -d ':' -f 2 | cut -d '/' -f 3)
|
||||||
|
DATABASE_PASSWORD=$(echo $DATABASE_URL | cut -d ':' -f 3 | cut -d '@' -f 1)
|
||||||
|
DATABASE_HOST=$(echo $DATABASE_URL | cut -d '@' -f 2 | cut -d ':' -f 1)
|
||||||
|
DATABASE_PORT=$(echo $DATABASE_URL | cut -d ':' -f 4 | cut -d '/' -f 1)
|
||||||
|
DATABASE_NAME=$(echo $DATABASE_URL | cut -d '/' -f 4)
|
||||||
|
|
||||||
|
# Export the extracted variables as environment variables
|
||||||
|
export GITEA__database__USER=$DATABASE_USER
|
||||||
|
export GITEA__database__PASSWD=$DATABASE_PASSWORD
|
||||||
|
export GITEA__database__HOST=$DATABASE_HOST
|
||||||
|
export GITEA__database__NAME=$DATABASE_NAME
|
||||||
|
export GITEA__database__DB_TYPE=postgres
|
||||||
|
export GITEA__database__SSL_MODE=require
|
||||||
|
|
||||||
|
/usr/local/bin/gitea web -port $PORT
|
Loading…
Reference in New Issue
Block a user