mirror of
https://github.com/n0-computer/iroh.git
synced 2026-11-30 00:01:16 +00:00
115 lines
3.7 KiB
YAML
115 lines
3.7 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
|
|
|
|
env:
|
|
IROH_FORCE_STAGING_RELAYS: "1"
|
|
|
|
jobs:
|
|
build_and_publish:
|
|
timeout-minutes: 30
|
|
name: Docker
|
|
runs-on: [self-hosted, linux, X64]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v4
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v4
|
|
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@v5
|
|
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
|
|
run: |
|
|
aws s3 cp s3://vorc/iroh-relay-linux-amd64-musl-${{ inputs.base_hash }} bins/linux/amd64/iroh-relay
|
|
aws s3 cp s3://vorc/iroh-dns-server-linux-amd64-musl-${{ inputs.base_hash }} bins/linux/amd64/iroh-dns-server
|
|
|
|
aws s3 cp s3://vorc/iroh-relay-linux-aarch64-musl-${{ inputs.base_hash }} bins/linux/arm64/iroh-relay
|
|
aws s3 cp s3://vorc/iroh-dns-server-linux-aarch64-musl-${{ inputs.base_hash }} bins/linux/arm64/iroh-dns-server
|
|
|
|
- name: Build Docker image (iroh-relay)
|
|
uses: docker/build-push-action@v7
|
|
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@v7
|
|
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
|