2021-04-02 01:39:01 +00:00
|
|
|
# SPDX-FileCopyrightText: 2020 Luke Granger-Brown <depot@lukegb.com>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
|
|
{ pkgs, ... }:
|
|
|
|
let
|
|
|
|
origImageArgs = {
|
|
|
|
imageName = "octobus/heptapod";
|
2021-10-09 01:16:36 +00:00
|
|
|
imageDigest = "sha256:5b615af5b0cfa13beddc19e90a6e6e8334efa9cc2f7d05b3f944e0d0f350598b";
|
|
|
|
sha256 = "sha256:01g0k7ajigfan7zm0c2r587wi77r2vhpsgfm14ws5bxgxsd5q1p3";
|
2021-04-02 01:39:01 +00:00
|
|
|
finalImageName = "octobus/heptapod";
|
2021-10-09 01:16:36 +00:00
|
|
|
finalImageTag = "0.25.1";
|
2021-04-02 01:39:01 +00:00
|
|
|
};
|
|
|
|
origImage = pkgs.dockerTools.pullImage origImageArgs;
|
|
|
|
|
|
|
|
name = origImageArgs.imageName;
|
|
|
|
tag = "${origImageArgs.finalImageTag}-lukegb";
|
|
|
|
in pkgs.dockerTools.buildImage rec {
|
|
|
|
inherit name tag;
|
|
|
|
fromImage = origImage;
|
|
|
|
fromImageName = origImageArgs.finalImageName;
|
|
|
|
fromImageTag = origImageArgs.finalImageTag;
|
|
|
|
diskSize = 8192;
|
|
|
|
runAsRoot = ''
|
|
|
|
#!{pkgs.runtimeShell}
|
|
|
|
cat <<"EOF" >/assets/wrapper_wrapper
|
2021-04-02 02:08:40 +00:00
|
|
|
#!/bin/bash
|
|
|
|
/usr/bin/id hg || /usr/sbin/useradd -g $(id -u git) -u $(id -g git) -o -d /var/opt/gitlab -p "*" hg
|
|
|
|
/usr/bin/grep "AllowUsers git hg" /assets/sshd_config || /bin/sed -i "s/AllowUsers git/AllowUsers git hg/" /assets/sshd_config
|
|
|
|
exec /assets/wrapper "$@"
|
2021-04-02 01:39:01 +00:00
|
|
|
EOF
|
|
|
|
chmod ugo=rx /assets/wrapper_wrapper
|
|
|
|
'';
|
|
|
|
config.Cmd = ["/assets/wrapper_wrapper"];
|
|
|
|
} // {
|
|
|
|
meta = { inherit name tag; };
|
|
|
|
}
|