aboutsummaryrefslogtreecommitdiff
path: root/entrypoint.bash
diff options
context:
space:
mode:
authorAlex Pooley (@zuedev) <zuedev@gmail.com>2026-05-07 12:16:28 +0100
committerAlex Pooley (@zuedev) <zuedev@gmail.com>2026-05-07 12:16:28 +0100
commit69033ecacc726a9bc7532afdf97260109f4b6c1c (patch)
tree8aa8c1ab3607ab1b399702c5cad46f39c4980d7a /entrypoint.bash
downloadgit.zue.dev-69033ecacc726a9bc7532afdf97260109f4b6c1c.tar
git.zue.dev-69033ecacc726a9bc7532afdf97260109f4b6c1c.tar.gz
git.zue.dev-69033ecacc726a9bc7532afdf97260109f4b6c1c.tar.bz2
git.zue.dev-69033ecacc726a9bc7532afdf97260109f4b6c1c.tar.xz
git.zue.dev-69033ecacc726a9bc7532afdf97260109f4b6c1c.zip
initial commit
Diffstat (limited to 'entrypoint.bash')
-rw-r--r--entrypoint.bash28
1 files changed, 28 insertions, 0 deletions
diff --git a/entrypoint.bash b/entrypoint.bash
new file mode 100644
index 0000000..80e7c91
--- /dev/null
+++ b/entrypoint.bash
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# This script is the entry point for the git server container. It sets up the necessary environment and starts the git sshd service.
+
+# Do we have an authorized_keys environment variable?
+if [ -n "$AUTHORIZED_KEYS" ]; then
+ echo "Setting up authorized_keys..."
+ mkdir -p /home/git/.ssh
+ echo "$AUTHORIZED_KEYS" > /home/git/.ssh/authorized_keys
+ chmod 600 /home/git/.ssh/authorized_keys
+ chown -R git:git /home/git/.ssh
+else
+ echo "No AUTHORIZED_KEYS environment variable found. Exiting."
+ exit 1
+fi
+
+# Set the correct permissions for the git user
+chown -R git:git /home/git
+
+# Start the SSH service in the background
+echo "Starting SSH service..."
+/usr/sbin/sshd -D -E /var/log/sshd.log &
+
+# Wait for the SSH service to start
+sleep 2
+
+# Watch the SSH log for any errors
+tail -f /var/log/sshd.log \ No newline at end of file