Skip to content
This repository has been archived by the owner on Dec 3, 2021. It is now read-only.

Commit

Permalink
Fix gitea image to run on git user
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Oswalt <[email protected]>
  • Loading branch information
Mierdin committed Apr 13, 2020
1 parent f77a241 commit 2ba821e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
14 changes: 12 additions & 2 deletions images/gitea/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
10 changes: 5 additions & 5 deletions images/gitea/data-init/gitea/conf/app.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
APP_NAME = NRE Labs Git Server
RUN_MODE = prod
RUN_USER = root
RUN_USER = git

[repository]
ROOT = /data/git/repositories
Expand All @@ -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]
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Binary file modified images/gitea/data-init/gitea/gitea.db
Binary file not shown.
5 changes: 4 additions & 1 deletion images/gitea/launch.sh
Original file line number Diff line number Diff line change
@@ -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 [email protected] --admin
su -c '/app/gitea/gitea -c /data/gitea/conf/app.ini admin create-user --name nreadmin --password Password1! --email [email protected] --admin' git

# Start Gitea (original CMD from Gitea's Dockerfile)
/bin/s6-svscan /etc/s6

0 comments on commit 2ba821e

Please sign in to comment.