add gitea bonus

This commit is contained in:
2026-09-02 10:23:27 +02:00
parent f7b8fceb28
commit 072d878c31
5 changed files with 121 additions and 0 deletions
+4
View File
@@ -14,3 +14,7 @@ WP_USER=oriabenk
WP_USER_EMAIL=oriabenk@oriabenk.42.fr WP_USER_EMAIL=oriabenk@oriabenk.42.fr
FTP_USER=oriabenk FTP_USER=oriabenk
GITEA_DOMAIN=localhost
GITEA_ADMIN_USER=oriabenk
GITEA_ADMIN_EMAIL=oriabenk@oriabenk.42.fr
+23
View File
@@ -73,6 +73,21 @@ services:
- "8080:80" - "8080:80"
restart: always restart: always
gitea:
build: ./requirements/gitea
image: gitea:inception
container_name: gitea
env_file: .env
secrets:
- gitea_admin_password
volumes:
- gitea_data:/data
networks:
- inception
ports:
- "3000:3000"
restart: always
networks: networks:
inception: inception:
driver: bridge driver: bridge
@@ -90,6 +105,12 @@ volumes:
type: none type: none
o: bind o: bind
device: ${DATA_PATH}/wordpress device: ${DATA_PATH}/wordpress
gitea_data:
driver: local
driver_opts:
type: none
o: bind
device: ${DATA_PATH}/gitea
secrets: secrets:
db_root_password: db_root_password:
@@ -102,3 +123,5 @@ secrets:
file: ../secrets/wp_user_password.txt file: ../secrets/wp_user_password.txt
ftp_password: ftp_password:
file: ../secrets/ftp_password.txt file: ../secrets/ftp_password.txt
gitea_admin_password:
file: ../secrets/gitea_admin_password.txt
+23
View File
@@ -0,0 +1,23 @@
FROM debian:bookworm-slim
ARG GITEA_VERSION=1.27.3
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
RUN curl -fsSL -o /usr/local/bin/gitea \
"https://dl.gitea.com/gitea/${GITEA_VERSION}/gitea-${GITEA_VERSION}-linux-amd64" \
&& chmod +x /usr/local/bin/gitea
RUN useradd -m -d /data -s /usr/sbin/nologin git
COPY conf/app.ini.template /etc/gitea/app.ini.template
COPY tools/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
EXPOSE 3000
ENTRYPOINT ["entrypoint.sh"]
@@ -0,0 +1,31 @@
APP_NAME = oriabenk's Git
RUN_MODE = prod
WORK_PATH = /data
[server]
PROTOCOL = http
DOMAIN = __GITEA_DOMAIN__
HTTP_ADDR = 0.0.0.0
HTTP_PORT = 3000
ROOT_URL = http://__GITEA_DOMAIN__:3000/
DISABLE_SSH = true
OFFLINE_MODE = true
[database]
DB_TYPE = sqlite3
PATH = /data/gitea/gitea.db
[security]
INSTALL_LOCK = true
SECRET_KEY = __SECRET_KEY__
INTERNAL_TOKEN = __INTERNAL_TOKEN__
[oauth2]
JWT_SECRET = __JWT_SECRET__
[service]
DISABLE_REGISTRATION = true
[log]
MODE = console
LEVEL = info
@@ -0,0 +1,40 @@
#!/bin/bash
set -e
export HOME=/data
GITEA_ADMIN_PASSWORD=$(cat /run/secrets/gitea_admin_password)
if [ ! -f "/data/gitea/conf/app.ini" ]; then
mkdir -p /data/gitea/conf /data/git/repositories /data/gitea/log
SECRET_KEY=$(gitea generate secret SECRET_KEY)
INTERNAL_TOKEN=$(gitea generate secret INTERNAL_TOKEN)
JWT_SECRET=$(gitea generate secret JWT_SECRET)
sed \
-e "s|__GITEA_DOMAIN__|${GITEA_DOMAIN}|g" \
-e "s|__SECRET_KEY__|${SECRET_KEY}|" \
-e "s|__INTERNAL_TOKEN__|${INTERNAL_TOKEN}|" \
-e "s|__JWT_SECRET__|${JWT_SECRET}|" \
/etc/gitea/app.ini.template > /data/gitea/conf/app.ini
chown -R git:git /data
setpriv --reuid=git --regid=git --clear-groups \
/usr/local/bin/gitea migrate --config /data/gitea/conf/app.ini
setpriv --reuid=git --regid=git --clear-groups \
/usr/local/bin/gitea admin user create \
--config /data/gitea/conf/app.ini \
--username "${GITEA_ADMIN_USER}" \
--password "${GITEA_ADMIN_PASSWORD}" \
--email "${GITEA_ADMIN_EMAIL}" \
--admin \
--must-change-password=false
fi
chown -R git:git /data
exec setpriv --reuid=git --regid=git --clear-groups \
/usr/local/bin/gitea web --config /data/gitea/conf/app.ini