fix opencode and gitea integration
This commit is contained in:
@@ -7,6 +7,7 @@ RUN pacman -Syu --noconfirm && \
|
|||||||
npm \
|
npm \
|
||||||
git \
|
git \
|
||||||
iptables \
|
iptables \
|
||||||
|
openssh \
|
||||||
opencode \
|
opencode \
|
||||||
&& pacman -Scc --noconfirm
|
&& pacman -Scc --noconfirm
|
||||||
|
|
||||||
|
|||||||
@@ -9,12 +9,11 @@ services:
|
|||||||
- NET_ADMIN # required for iptables in entrypoint
|
- NET_ADMIN # required for iptables in entrypoint
|
||||||
- NET_RAW
|
- NET_RAW
|
||||||
volumes:
|
volumes:
|
||||||
# Your monorepo — opencode's working directory
|
# Your monorepo
|
||||||
- /home/ga/workspace:/workspace
|
- /home/ga/workspace:/workspace
|
||||||
# SSH key for Gitea auth
|
# Mount entire SSH directory from host
|
||||||
- ~/.ssh/id_ed25519:/root/.ssh/id_ed25519
|
- /home/ga/.ssh:/root/.ssh
|
||||||
- ~/.ssh/known_hosts:/root/.ssh/known_hosts:ro
|
# Persist opencode auth
|
||||||
# Persist opencode auth so you don't re-login every time
|
|
||||||
- opencode-auth:/root/.local/share/opencode
|
- opencode-auth:/root/.local/share/opencode
|
||||||
environment:
|
environment:
|
||||||
- OPENCODE_API_KEY=${OPENCODE_API_KEY}
|
- OPENCODE_API_KEY=${OPENCODE_API_KEY}
|
||||||
|
|||||||
@@ -1,26 +1,22 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Fix SSH directory and key permissions
|
# Fix SSH directory permissions
|
||||||
chmod 700 /root/.ssh
|
chmod 700 /root/.ssh
|
||||||
chmod 600 /root/.ssh/id_ed25519
|
chmod 600 /root/.ssh/id_ed25519
|
||||||
|
|
||||||
# Add Gitea server to known_hosts (suppress errors if network unavailable)
|
# Copy known_hosts to tmp if it's read-only (from host mount)
|
||||||
ssh-keyscan -H git.processhub.work >> /root/.ssh/known_hosts 2>/dev/null || true
|
cp /root/.ssh/known_hosts /tmp/known_hosts 2>/dev/null || touch /tmp/known_hosts
|
||||||
|
chmod 600 /tmp/known_hosts
|
||||||
|
|
||||||
# Allow outbound SSH to Gitea
|
# Add Gitea to known_hosts
|
||||||
GITEA_IP=$(getent hosts git.processhub.work | awk '{print $1}' | head -1)
|
ssh-keyscan -H git.processhub.work >> /tmp/known_hosts 2>/dev/null || true
|
||||||
if [ -n "$GITEA_IP" ]; then
|
|
||||||
iptables -A OUTPUT -p tcp --dport 22 -d "$GITEA_IP" -j ACCEPT 2>/dev/null || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Configure SSH to use the correct key
|
# Configure SSH
|
||||||
export GIT_SSH_COMMAND="ssh -i /root/.ssh/id_ed25519 -o StrictHostKeyChecking=accept-new"
|
export GIT_SSH_COMMAND="ssh -i /root/.ssh/id_ed25519 -o UserKnownHostsFile=/tmp/known_hosts -o StrictHostKeyChecking=accept-new"
|
||||||
|
|
||||||
# Configure git user
|
# Git config
|
||||||
git config --global user.email "gabriel.pereira@protonmail.com"
|
git config --global user.email "gabriel.pereira@protonmail.com"
|
||||||
git config --global user.name "gabspereira"
|
git config --global user.name "gabspereira"
|
||||||
|
|
||||||
# Configure git safe directory (system-wide + workspace specific)
|
|
||||||
git config --system --add safe.directory '*'
|
git config --system --add safe.directory '*'
|
||||||
git config --global --add safe.directory /workspace
|
git config --global --add safe.directory /workspace
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user