mirror of
https://git.sr.ht/~magic_rb/cluster
synced 2024-11-22 08:04:20 +01:00
docker: gitea: add Gitea
This commit is contained in:
parent
e3e183696f
commit
bfb5972fa0
77
docker/gitea/default.nix
Normal file
77
docker/gitea/default.nix
Normal file
|
@ -0,0 +1,77 @@
|
|||
{ pkgs, system, nixpkgs, ... }:
|
||||
let
|
||||
# pkgs = (import nixpkgs { inherit system; }).pkgsMusl;
|
||||
init = let
|
||||
defaults = {
|
||||
uid = builtins.toString 5001;
|
||||
gid = builtins.toString 5001;
|
||||
user = "gitea";
|
||||
data = "/data/gitea";
|
||||
};
|
||||
custom = rec {
|
||||
gitea = pkgs.gitea.override {
|
||||
inherit openssh git;
|
||||
pamSupport = false;
|
||||
};
|
||||
openssh = pkgs.openssh.override {
|
||||
withKerberos = false; withFIDO = false;
|
||||
};
|
||||
git = pkgs.git.override {
|
||||
inherit openssh;
|
||||
perlSupport = false;
|
||||
nlsSupport = false;
|
||||
withManual = false;
|
||||
guiSupport = false;
|
||||
pythonSupport = false;
|
||||
withpcre2 = false;
|
||||
sendEmailSupport = false;
|
||||
};
|
||||
};
|
||||
in
|
||||
with pkgs; with defaults; pkgs.writeShellScriptBin "init" ''
|
||||
if [[ $(${busybox}/bin/id -u) = 0 ]] ; then
|
||||
|
||||
${busybox}/bin/cat << EOF
|
||||
### Gitea Nix Image Manual
|
||||
##
|
||||
## USER_UID ? ${uid} - default user id
|
||||
## USER_GID ? ${gid} - default group id
|
||||
## for other options please look at https://docs.gitea.io/en-us/install-with-docker/#environment-variables
|
||||
|
||||
### Recommended volumes (many directories which exist in normal Docker containers, do not exist in this one)
|
||||
##
|
||||
## - ${data} - Gitea base data folder
|
||||
EOF
|
||||
|
||||
export _user_uid="''${USER_UID:-${uid}}" \
|
||||
_user_uid="''${USER_UID:-${uid}}" \
|
||||
_user="''${USER:-${user}}"
|
||||
|
||||
${busybox}/bin/cat << EOF
|
||||
### Starting with options:
|
||||
## USER_UID = "$_user_uid"
|
||||
## USER_GID = "$_user_uid"
|
||||
EOF
|
||||
|
||||
|
||||
echo "gitea:x:$_uid:$_postgres_gid:Gitea:${data}:${bash}/bin/bash" > /etc/passwd
|
||||
echo "gitea:x:$_gid:" > /etc/group
|
||||
|
||||
${busybox}/bin/mkdir -p ${data}
|
||||
|
||||
exec ${busybox}/bin/su -p gitea -c "$0"
|
||||
else
|
||||
|
||||
exec ${custom.gitea}/bin/gitea $@
|
||||
|
||||
fi
|
||||
'';
|
||||
in
|
||||
pkgs.dockerTools.buildLayeredImage {
|
||||
name = "gitea";
|
||||
tag = "latest";
|
||||
|
||||
config = {
|
||||
Cmd = [ "${init}/bin/init" ];
|
||||
};
|
||||
}
|
|
@ -34,6 +34,7 @@
|
|||
dockerImages = lib.dockerImages ./docker [
|
||||
"klippy-moonraker"
|
||||
"postgresql"
|
||||
"gitea"
|
||||
"csi-driver-nfs"
|
||||
];
|
||||
pkgs = lib.pkgsWithFlakes flakes;
|
||||
|
|
Loading…
Reference in a new issue