adding autocreate for admin user

This commit is contained in:
2022-08-02 10:53:25 -04:00
parent 063409bb88
commit 9aa234f229
2 changed files with 18 additions and 2 deletions

View File

@@ -21,6 +21,7 @@ EXPOSE 22 3000
USER gitea:gitea
ENTRYPOINT ["/usr/bin/gitea"]
# ENTRYPOINT ["/usr/bin/gitea"]
ENTRYPOINT ["./start.sh"]
CMD ["web", "-c", "/data/app.ini"]
# CMD ["web", "-c", "/data/app.ini"]

15
gitea/start.sh Normal file
View File

@@ -0,0 +1,15 @@
ATTEMPT=0
MAX_ATTEMPT=20
while true; do
sleep 1
ATTEMPT=$(($ATTEMPT + 1))
STATUS_CODE=$(curl -LI localhost:3000 -o /dev/null -w '%{http_code}\n' -s)
if [ $STATUS_CODE = "200" ]; then
echo "Gitea is ready"
echo "Create Gitea admin"
gitea admin create-user --admin --username $ADMIN_USER --password $ADMIN_PASSWORD --email $ADMIN_EMAIL --must-change-password=false
exit 0
elif [ $ATTEMPT = $MAX_ATTEMPT ]; then
exit 1
fi;
done & /usr/bin/gitea