githubEdit

How do I use SSH mount and secrets with duplocloud/actions/build-image?

Context When building Docker images using the duplocloud/actions/build-image GitHub Action, you may need to use SSH mount or pass secrets during the build process. This is commonly needed when your Dockerfile requires cloning repositories or downloading from private sources that require authentication during the build step. Answer To use SSH mount and secrets with the duplocloud/actions/build-image action, you should use the extra-args parameter instead of build-args . The extra-args parameter adds arguments directly to the Docker CLI command itself. Here's how to configure it:

  • name: Build and Push Docker Image uses: duplocloud/actions/build-image@main with: repo: my-repo registry: my-registry platforms: linux/amd64,linux/arm64 build-args: > SOME_VAR=hello context: ./app dockerfile: Dockerfile.dev push: true cache: true extra-args: > --ssh=default=$SSH_AUTH_SOCK Key points: Use extra-args for Docker CLI arguments like --ssh Use build-args for build-time variables that get passed to the Dockerfile You can check the workflow summary to see the actual Docker command that gets executed to verify it's building the command you expect This approach allows you to pass SSH authentication and secrets to your Docker build process when using the duplocloud/actions/build-image GitHub Action.

Last updated

Was this helpful?