diff --git a/Dockerfile b/Dockerfile index 2a2009e..507db39 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,6 +36,17 @@ # ssh_key= # Then redeploy. # +# Gitea SSH port note +# ─────────────────── +# Our self-hosted Gitea is configured with SSH on port 222, not the +# default 22. Port 22 on git.kadil.dev hits the Docker host's +# OpenSSH (not Gitea), so deploy keys added through Gitea's UI +# wouldn't authorize anything if we connected on 22. The package.json +# git+ssh URL specifies `:222` in the host portion to route through +# Gitea's own SSH server, and the `ssh-keyscan -p 222` below scans +# the matching port so the known_hosts entry uses the same +# [host]:port form that the URL resolves to. +# # Local build with the same approach # ─────────────────────────────────── # base64 < ~/.ssh/goods-editor-deploy | tr -d '\n' > /tmp/key.b64 @@ -150,23 +161,9 @@ COPY package*.json ./ # Re-paste from a fresh `base64 < key | tr -d '\n' | pbcopy`. RUN --mount=type=secret,id=ssh_key \ mkdir -p -m 0700 ~/.ssh && \ - ssh-keyscan git.kadil.dev >> ~/.ssh/known_hosts 2>/dev/null && \ + ssh-keyscan -p 222 git.kadil.dev >> ~/.ssh/known_hosts 2>/dev/null && \ base64 -d /run/secrets/ssh_key > /tmp/ssh_key && \ chmod 0600 /tmp/ssh_key && \ - echo "=== Key identity diagnostic ===" && \ - echo "Encoded secret size: $(wc -c < /run/secrets/ssh_key) bytes" && \ - echo "Decoded key size: $(wc -c < /tmp/ssh_key) bytes" && \ - echo "Fingerprint:" && \ - ssh-keygen -lf /tmp/ssh_key 2>&1 || echo " (failed to read key)" && \ - echo "Derived public key (compare against Gitea's registered deploy key):" && \ - ssh-keygen -y -f /tmp/ssh_key 2>&1 || echo " (failed to derive public key)" && \ - echo "=== end diagnostic ===" && \ - echo "" && \ - echo "=== git ls-remote probe (mirrors local working command) ===" && \ - GIT_SSH_COMMAND="ssh -vv -i /tmp/ssh_key -o IdentitiesOnly=yes -o UserKnownHostsFile=/root/.ssh/known_hosts" \ - git ls-remote ssh://git@git.kadil.dev/khalidadil/goods-editor-module.git 2>&1 | head -120 || echo "(ls-remote probe failed, continuing to npm install for completeness)" && \ - echo "=== end ls-remote probe ===" && \ - echo "" && \ GIT_SSH_COMMAND="ssh -i /tmp/ssh_key -o IdentitiesOnly=yes -o UserKnownHostsFile=/root/.ssh/known_hosts" \ npm install && \ rm -f /tmp/ssh_key diff --git a/package.json b/package.json index 37f1e4f..77e75c2 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "test": "echo 'Editor tests live in the goods-editor module. Run them from there.' && exit 0" }, "dependencies": { - "goods-editor": "git+ssh://git@git.kadil.dev/khalidadil/goods-editor-module.git#v0.1.0-alpha.2", + "goods-editor": "git+ssh://git@git.kadil.dev:222/khalidadil/goods-editor-module.git#v0.1.0-alpha.2", "canvas": "^3.0.0", "cors": "^2.8.5", "express": "^4.18.2",