Build & Deploy (Nix) / build-and-deploy (push) Failing after 53s
Docker socket /var/run/docker.sock is available in the runner container. Use docker run --pid=host --privileged to access the VPS host filesystem via chroot to execute nix-env and systemctl. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
46 lines
1.3 KiB
YAML
46 lines
1.3 KiB
YAML
name: Build & Deploy (Nix)
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Nix
|
|
run: |
|
|
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix \
|
|
| sh -s -- install --no-confirm 2>&1
|
|
echo "/nix/var/nix/profiles/default/bin" >> "$GITHUB_PATH"
|
|
|
|
- name: Build with Nix
|
|
run: |
|
|
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh || true
|
|
nix build .#teleuploader --impure --option sandbox false 2>&1
|
|
|
|
- name: Deploy via Docker socket (host access)
|
|
run: |
|
|
set -eu
|
|
STORE_PATH=$(readlink result)
|
|
|
|
# Use Docker socket to run commands on the VPS host
|
|
docker run --rm --pid=host --privileged \
|
|
-v /:/host \
|
|
alpine:latest \
|
|
chroot /host sh -c "
|
|
nix-env --profile /nix/var/nix/profiles/teleuploader --set '$STORE_PATH' && \
|
|
systemctl restart teleuploader
|
|
"
|
|
|
|
echo "=== Service status ==="
|
|
docker run --rm --pid=host --privileged \
|
|
-v /:/host \
|
|
alpine:latest \
|
|
chroot /host sh -c "systemctl status teleuploader --no-pager | head -15"
|