Files
iroh/.github/workflows/docker.yaml
T
Asmir Avdicevic 89ed3bfdaf ci(secruity): hardening + lock files + dependabot cooldown (#4480)
## Description

Same pricinple as https://github.com/n0-computer/noq/pull/788

Uses --locked to ensure we only use deps from the lock file
Adds cooldown period to dependabot
pins actions versions
introduces zizimor and pinact

## Breaking Changes

<!-- Optional, if there are any breaking changes document them,
including how to migrate older code. -->

## Notes & open questions

<!-- Any notes, remarks or open questions you have to make about the PR.
-->

## Change checklist
<!-- Remove any that are not relevant. -->
- [ ] Self-review.
- [ ] Documentation updates following the [style
guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text),
if relevant.
- [ ] Tests if relevant.
- [ ] All breaking changes documented.
- [ ] This PR was created by a human that thought critically about the
      proposed change and wrote an as clear and concise description as
      they could.
- [ ] This PR isn't slop, and is carefully crafted to do have the
      intented effect.
2026-08-21 10:24:02 +00:00

132 lines
4.3 KiB
YAML

name: Docker
on:
workflow_dispatch:
inputs:
release_version:
description: "Release version"
required: true
type: string
default: ""
base_hash:
description: "Commit hash from which to build"
required: true
type: string
default: ""
publish:
description: "Publish to Docker Hub"
required: true
type: boolean
default: false
workflow_call:
inputs:
release_version:
description: "Release version"
required: true
type: string
default: ""
base_hash:
description: "Commit hash from which to build"
required: true
type: string
default: ""
publish:
description: "Publish to Docker Hub"
required: true
type: boolean
default: false
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_TOKEN:
required: true
S3_ACCESS_KEY_ID:
required: true
S3_ACCESS_KEY:
required: true
env:
IROH_FORCE_STAGING_RELAYS: "1"
# Default to read-only; jobs that need more grant it explicitly.
permissions:
contents: read
jobs:
build_and_publish:
timeout-minutes: 30
name: Docker
runs-on: [self-hosted, linux, X64]
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
- name: Login to Docker Hub
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Prep dirs
run: |
mkdir -p bins/linux/amd64
mkdir -p bins/linux/arm64
- name: Cache AWS CLI
id: cache-awscli
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/awscli
key: awscli-${{ runner.os }}-${{ runner.arch }}-v2
- name: Download awscli
if: steps.cache-awscli.outputs.cache-hit != 'true'
run: |
mkdir -p ~/awscli
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o ~/awscli/awscliv2.zip
cd ~/awscli && unzip -oq awscliv2.zip
- name: Install awscli
run: sudo ~/awscli/aws/install --update
- name: Set aws credentials
run: |
echo "AWS_ACCESS_KEY_ID=${{secrets.S3_ACCESS_KEY_ID}}" >> $GITHUB_ENV
echo "AWS_SECRET_ACCESS_KEY=${{secrets.S3_ACCESS_KEY}}" >> $GITHUB_ENV
echo "AWS_DEFAULT_REGION=us-west-2" >> $GITHUB_ENV
- name: Fetch release binaries
env:
BASE_HASH: ${{ inputs.base_hash }}
run: |
aws s3 cp "s3://vorc/iroh-relay-linux-amd64-musl-$BASE_HASH" bins/linux/amd64/iroh-relay
aws s3 cp "s3://vorc/iroh-dns-server-linux-amd64-musl-$BASE_HASH" bins/linux/amd64/iroh-dns-server
aws s3 cp "s3://vorc/iroh-relay-linux-aarch64-musl-$BASE_HASH" bins/linux/arm64/iroh-relay
aws s3 cp "s3://vorc/iroh-dns-server-linux-aarch64-musl-$BASE_HASH" bins/linux/arm64/iroh-dns-server
- name: Build Docker image (iroh-relay)
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: .
push: ${{ inputs.publish }}
tags: n0computer/iroh-relay:latest,n0computer/iroh-relay:${{ inputs.release_version }}
target: iroh-relay
platforms: linux/amd64,linux/arm64/v8
file: docker/Dockerfile.ci
- name: Build Docker image (iroh-dns-server)
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: .
push: ${{ inputs.publish }}
tags: n0computer/iroh-dns-server:latest,n0computer/iroh-dns-server:${{ inputs.release_version }}
target: iroh-dns-server
platforms: linux/amd64,linux/arm64/v8
file: docker/Dockerfile.ci