mirror of
https://github.com/sstent/containers.git
synced 2025-12-06 08:01:51 +00:00
adding autocreate for admin user
This commit is contained in:
@@ -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
15
gitea/start.sh
Normal 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
|
||||
Reference in New Issue
Block a user