Sign inSign up

grooveshaker/rsync-ssh

By grooveshaker

â€ĒUpdated 12 months ago

Alpine image with rsync, OpenSSH, and SSH key support.

Image
0

556

grooveshaker/rsync-ssh repository overview

⁠rsync-ssh

A tiny Alpine-based image with rsync and OpenSSH client preinstalled, plus a helper prepare-ssh entrypoint that wires up your SSH key from environment variables at runtime. Ideal for GitLab CI/CD or any pipeline where you want to deploy via rsync over SSH without running apk add on every job.

⁠Features

  • 🧰 Includes rsync, openssh-client (no sudo/sshd)
  • 🚀 Zero package installs at runtime (fast CI)
  • 🔐 prepare-ssh sets up ~/.ssh from environment variables
  • ðŸŠķ Minimal footprint (Alpine base)

⁠Quick Start

# .gitlab-ci.yml (example)
deploy:
  stage: deploy
  image: docker.io/grooveshaker/rsync-ssh:latest
  variables:
    # Optional: make first connect non-interactive
    SSH_OPTIONS: "-o StrictHostKeyChecking=accept-new"
  script:
    - rsync -avz -e "ssh $SSH_OPTIONS" out/${RELEASE_NAME}/ ${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_DIR}/releases/${RELEASE_NAME}/
    - ssh $SSH_OPTIONS ${DEPLOY_USER}@${DEPLOY_HOST} "cd ${DEPLOY_DIR} && ln -sfn releases/${RELEASE_NAME} current"
    - ssh $SSH_OPTIONS ${DEPLOY_USER}@${DEPLOY_HOST} "sudo systemctl restart ${APP_NAME}"

⁠Environment Variables

  • SSH_PRIVATE_KEY (required): the private key content (e.g., ed25519).
  • DEPLOY_HOST (optional): used by ssh-keyscan to pre-populate known_hosts.
  • Any other variables (e.g., DEPLOY_USER, DEPLOY_DIR, RELEASE_NAME, APP_NAME) are consumed by your CI script.

⁠Entrypoint Behavior

prepare-ssh will:

  1. create ~/.ssh with correct permissions
  2. write $SSH_PRIVATE_KEY to ~/.ssh/id_ed25519
  3. run ssh-keyscan -H "$DEPLOY_HOST" if provided
  4. exec "$@" to run your command (e.g., the CI shell)

You can override the command at runtime:

docker run --rm -e SSH_PRIVATE_KEY="$(cat ~/.ssh/id_ed25519)" \
  -e DEPLOY_HOST=example.com \
  docker.io/grooveshaker/rsync-ssh:latest rsync --version

⁠License

MIT. See source repository for the Dockerfile.

Tag summary

Content type

Image

Digest

sha256:b60dfdab4â€Ķ

Size

6 MB

Last updated

12 months ago

docker pull grooveshaker/rsync-ssh