From 2ba821e5fb8087af29a56459af031d353388afbc Mon Sep 17 00:00:00 2001 From: Matt Oswalt Date: Mon, 13 Apr 2020 15:43:40 -0700 Subject: [PATCH] Fix gitea image to run on git user Signed-off-by: Matt Oswalt --- images/gitea/Dockerfile | 14 ++++++++++++-- images/gitea/data-init/gitea/conf/app.ini | 10 +++++----- images/gitea/data-init/gitea/gitea.db | Bin 1155072 -> 1155072 bytes images/gitea/launch.sh | 5 ++++- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/images/gitea/Dockerfile b/images/gitea/Dockerfile index c0dda9e9..49d82c49 100644 --- a/images/gitea/Dockerfile +++ b/images/gitea/Dockerfile @@ -1,11 +1,21 @@ FROM gitea/gitea:latest +# FROM gitea/gitea:1.4.1 + +# https://discourse.gitea.io/t/i-cannot-programmatically-setup-users-in-a-docker-container/289/5 # This directory contains a very basically bootstrapped system. It has no users, no repositories. # All I did was go through the initial wizard and provide the hostname and tagline. # Once I captured this, I manually deleted the data-init/ssh directory so Docker wouldn't choke on # the permissions. Gitea appears to regenerate this on startup if it's missing. -COPY data-init/ /data + + +# COPY data-init/ /data +COPY data-init/gitea/conf/app.ini /data/gitea/conf/app.ini +COPY data-init/gitea/gitea.db /data/gitea/gitea.db + +RUN chown -R git:git /data/gitea COPY launch.sh / -ENV USER=root +ENV USER=git + CMD ["/launch.sh"] \ No newline at end of file diff --git a/images/gitea/data-init/gitea/conf/app.ini b/images/gitea/data-init/gitea/conf/app.ini index e8be3519..f9953e54 100644 --- a/images/gitea/data-init/gitea/conf/app.ini +++ b/images/gitea/data-init/gitea/conf/app.ini @@ -1,6 +1,6 @@ APP_NAME = NRE Labs Git Server RUN_MODE = prod -RUN_USER = root +RUN_USER = git [repository] ROOT = /data/git/repositories @@ -22,7 +22,7 @@ SSH_LISTEN_PORT = 22 LFS_START_SERVER = true LFS_CONTENT_PATH = /data/git/lfs DOMAIN = gitea -LFS_JWT_SECRET = -hxSxsziloMRTYpb_6wQapWtUF9cOmC7L6CSi5hHH8g +LFS_JWT_SECRET = 1LIiZ-s_SUeFDO_au1grt5lJSmKBqC6zhyGcV_hkxRY OFFLINE_MODE = false [database] @@ -59,8 +59,8 @@ LEVEL = info [security] INSTALL_LOCK = true -SECRET_KEY = LXgsQ84FkIi10vWN9qgk2ksCdufy8uB5KXzY6YicTW4sQVmVClmLvnRF2Y5VbbvW -INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE1ODY3NTEzMDV9.XZ45vO3S9EcrQQNMxaarCB1KF-eXCeMHRIg3PXr1Izo +SECRET_KEY = UUrZy5XXHb6ECoMBiYv9zcMQJNNvVvR8ZfPEwQESx1uBd7iiKTmyuN4ptgNgG8sV +INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE1ODY4MTYxMDR9.SlDMPpDQ8rt_kzz3-Bj1-UDRKhRwiAh4ueY-ULYmvT8 [service] DISABLE_REGISTRATION = false @@ -75,7 +75,7 @@ DEFAULT_ENABLE_TIMETRACKING = true NO_REPLY_ADDRESS = noreply.localhost [oauth2] -JWT_SECRET = gqE8_QPtEUfYurRh4UAspbyZSBGTgvCemyjNa-M1l5s +JWT_SECRET = pd7QPHqDcsysEgb0qjcGtLYnaccV8SbWaPuYYuIgv4Y [mailer] ENABLED = false diff --git a/images/gitea/data-init/gitea/gitea.db b/images/gitea/data-init/gitea/gitea.db index 6273eb4651357b00a4a95ad4704b3b4dfa70a672..e2cdc14c08f4f8eabbbaf99d258ea42f45ed91a0 100644 GIT binary patch delta 4242 zcmbtX2~<{Bl79ET`~Lg>xAKedBm2*eiUI;=VRemW0R`H)qBf+(6$~9?jE1MSpn^o{ zrZmBgM(voy-8?7BcrXD?pJW=1-II=ELThKRlj9P55>3a2smI^W$(%VoXL|ZS@7%v` zRo$vvU)8PqUTw#?+KzEAFCoF3s|HCi9Sy$pM~n}d1N4@W}@t0 z^T=R#MG*InKa!3pbbcB(R zm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_Vzv6-L0maM9Mh-mOr^JBGuSURj3orDmS=c`y z8Vl$BssbH;RPC0v^nqW^fSduP%Y0-=*+7*!L@H^VkbC7nPO zR=CJ5j{bp`kz0DZ?nV<4N3Hs~@{zJo?v+FA>!q)xy|z(Xt1U$MwUEi*;n#30=yRg0 zJf9km+&jO#Zr$U}RnyCnavX0rr=HdyBs_1_LW4(}4gWl(C(!B*0WFPW%|^`AXY~2h z%$=&uBW6Xa)fDRpMRfz{4Qkn~$U4E*uh z5eQGv;-J^3)xgUMngn5u%n3C0azX;Xf0#B62NICeB;y4<%{diL!~7LIYJyv=2D2%v9`T^_=a3EnDbe_4;z{myUhv z7wTr^Q+c19VgJ~^-R={A5L<*?_AVp*QGPakpFT=HCzV_=@!b!)djo_&hHWLzB!XRL ziStzqeA{x@k|gk~lfz(BsWa9chR|eJWF$2fPvrb3DjS=s>uP`eA)#h(sdJo~zSDaC z|1vZjI-`5x;IQt4^Fz7{Fr){=CqGVSFeAp;0w1`wIZ$^7S#A&OGtG{EeYTDKVCfQK z`b~WbA$P148VqMWXqahl=>JG=2Qu&FH}nPfjC9{ZR-S#)jU}zZ`CUF*%Nr!k=k%v^ zqBS|bcbsz+t9#WHWkgvnUz0c6$L%iZ-=+EZCq71kD=VFOB>etiHn_dgIT;q0IDLH1 fQwn5klA|UJLc*Y_#F_G=!QeotGbUh!Z-oB_VVn_k diff --git a/images/gitea/launch.sh b/images/gitea/launch.sh index faa12c58..5218d3a7 100755 --- a/images/gitea/launch.sh +++ b/images/gitea/launch.sh @@ -1,7 +1,10 @@ #!/bin/bash +chown git:git /data/git +chown -R git:git /data/gitea + # Create first/admin user. Use this to connect via API and perform configuration tasks -gitea admin create-user --username nreadmin --password Password1! --email nreadmin@nrelabs.io --admin +su -c '/app/gitea/gitea -c /data/gitea/conf/app.ini admin create-user --name nreadmin --password Password1! --email nreadmin@nrelabs.io --admin' git # Start Gitea (original CMD from Gitea's Dockerfile) /bin/s6-svscan /etc/s6