feat(docker): cleanup docker files #7
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Docker Images | |
on: | |
release: | |
types: [published] | |
pull_request: | |
types: [opened, synchronize, reopened, ready_for_review] | |
workflow_dispatch: | |
inputs: | |
iota_node: | |
type: boolean | |
description: "Release iota-node image" | |
required: false | |
default: false | |
iota_indexer: | |
type: boolean | |
description: "Release iota-indexer image" | |
required: false | |
default: false | |
iota_tools: | |
type: boolean | |
description: "Release iota-tools image" | |
required: false | |
default: false | |
iota_graphql_rpc: | |
type: boolean | |
description: "Release iota-graphql-rpc image" | |
required: false | |
default: false | |
jobs: | |
build-iota-node: | |
runs-on: self-hosted | |
environment: release | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # pin@v4 | |
- name: Read Rust toolchain version from TOML | |
id: read_toolchain | |
run: | | |
TOOLCHAIN_VERSION=$(grep -oE 'channel = "[^"]+' ./rust-toolchain.toml | sed 's/channel = "//') | |
echo "TOOLCHAIN_VERSION=${TOOLCHAIN_VERSION}" >> $GITHUB_ENV | |
- name: Log Rust toolchain version | |
run: echo "Rust toolchain version is ${{ env.TOOLCHAIN_VERSION }}" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # pin@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # pin@v3 | |
- name: Docker meta for iota-node | |
id: meta-node | |
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # pin@v5 | |
with: | |
images: docker-registry.iota.org/iota-node | |
# mapping semver tags to networks | |
# v{MAJOR}.{MINOR}.{PATCH}-alpha -> alphanet | |
# v{MAJOR}.{MINOR}.{PATCH}-beta -> devnet | |
# v{MAJOR}.{MINOR}.{PATCH}-rc -> testnet | |
# v{MAJOR}.{MINOR}.{PATCH} -> mainnet | |
tags: | | |
type=raw,value={{sha}},enable=${{ github.event_name == 'workflow_dispatch' }} | |
type=raw,value=latest,enable=${{ github.event_name == 'workflow_dispatch' }} | |
type=raw,value={{tag}},enable=${{ github.event_name == 'release' }} | |
type=raw,value=alphanet,enable=${{ github.event_name == 'release' && contains(github.ref, '-alpha') }} | |
type=raw,value=devnet,enable=${{ github.event_name == 'release' && contains(github.ref, '-beta') }} | |
type=raw,value=testnet,enable=${{ github.event_name == 'release' && contains(github.ref, '-rc') }} | |
type=raw,value=mainnet,enable=${{ github.event_name == 'release' && !contains(github.ref, '-alpha') && !contains(github.ref, '-beta') && !contains(github.ref, '-rc') }} | |
- name: Login to Docker Registry | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # pin@v3 | |
with: | |
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }} | |
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }} | |
registry: ${{ secrets.DOCKER_REGISTRY_URL }} | |
# TODO: Remove when iota-sim is public https://github.com/iotaledger/iota/issues/2149 | |
- name: Set up SSH | |
uses: MrSquaare/ssh-setup-action@2d028b70b5e397cf8314c6eaea229a6c3e34977a # pin@v3 | |
with: | |
host: github.com | |
private-key: ${{ secrets.SSH_PRIVATE_KEY_IOTA_CI }} | |
private-key-name: github-ppk | |
- name: Build and push Docker image for iota-node | |
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # pin@v6 | |
with: | |
ssh: default | |
context: . | |
file: docker/iota-node/Dockerfile | |
build-args: | | |
RUST_IMAGE_VERSION=${{ env.TOOLCHAIN_VERSION }}-bookworm | |
platforms: linux/amd64 | |
tags: ${{ steps.meta-node.outputs.tags }} | |
push: true | |
pull: true | |
build-iota-indexer: | |
runs-on: self-hosted | |
environment: release | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # pin@v4 | |
- name: Read Rust toolchain version from TOML | |
id: read_toolchain | |
run: | | |
TOOLCHAIN_VERSION=$(grep -oE 'channel = "[^"]+' ./rust-toolchain.toml | sed 's/channel = "//') | |
echo "TOOLCHAIN_VERSION=${TOOLCHAIN_VERSION}" >> $GITHUB_ENV | |
- name: Log Rust toolchain version | |
run: echo "Rust toolchain version is ${{ env.TOOLCHAIN_VERSION }}" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # pin@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # pin@v3 | |
- name: Docker meta for iota-indexer | |
id: meta-indexer | |
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # pin@v5 | |
with: | |
images: docker-registry.iota.org/iota-indexer | |
# mapping semver tags to networks | |
# v{MAJOR}.{MINOR}.{PATCH}-alpha -> alphanet | |
# v{MAJOR}.{MINOR}.{PATCH}-beta -> devnet | |
# v{MAJOR}.{MINOR}.{PATCH}-rc -> testnet | |
# v{MAJOR}.{MINOR}.{PATCH} -> mainnet | |
tags: | | |
type=raw,value={{sha}},enable=${{ github.event_name == 'workflow_dispatch' }} | |
type=raw,value=latest,enable=${{ github.event_name == 'workflow_dispatch' }} | |
type=raw,value={{tag}},enable=${{ github.event_name == 'release' }} | |
type=raw,value=alphanet,enable=${{ github.event_name == 'release' && contains(github.ref, '-alpha') }} | |
type=raw,value=devnet,enable=${{ github.event_name == 'release' && contains(github.ref, '-beta') }} | |
type=raw,value=testnet,enable=${{ github.event_name == 'release' && contains(github.ref, '-rc') }} | |
type=raw,value=mainnet,enable=${{ github.event_name == 'release' && !contains(github.ref, '-alpha') && !contains(github.ref, '-beta') && !contains(github.ref, '-rc') }} | |
- name: Login to Docker Registry | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # pin@v3 | |
with: | |
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }} | |
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }} | |
registry: ${{ secrets.DOCKER_REGISTRY_URL }} | |
# TODO: Remove when iota-sim is public https://github.com/iotaledger/iota/issues/2149 | |
- name: Set up SSH | |
uses: MrSquaare/ssh-setup-action@2d028b70b5e397cf8314c6eaea229a6c3e34977a # pin@v3 | |
with: | |
host: github.com | |
private-key: ${{ secrets.SSH_PRIVATE_KEY_IOTA_CI }} | |
private-key-name: github-ppk | |
- name: Build and push Docker image for iota-indexer | |
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # pin@v6 | |
with: | |
ssh: default | |
context: . | |
file: docker/iota-indexer/Dockerfile | |
build-args: | | |
RUST_IMAGE_VERSION=${{ env.TOOLCHAIN_VERSION }}-bookworm | |
platforms: linux/amd64 | |
tags: ${{ steps.meta-indexer.outputs.tags }} | |
push: true | |
pull: true | |
build-iota-tools: | |
runs-on: self-hosted | |
environment: release | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # pin@v4 | |
- name: Read Rust toolchain version from TOML | |
id: read_toolchain | |
run: | | |
TOOLCHAIN_VERSION=$(grep -oE 'channel = "[^"]+' ./rust-toolchain.toml | sed 's/channel = "//') | |
echo "TOOLCHAIN_VERSION=${TOOLCHAIN_VERSION}" >> $GITHUB_ENV | |
- name: Log Rust toolchain version | |
run: echo "Rust toolchain version is ${{ env.TOOLCHAIN_VERSION }}" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # pin@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # pin@v3 | |
- name: Docker meta for iota-tools | |
id: meta-tools | |
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # pin@v5 | |
with: | |
images: docker-registry.iota.org/iota-tools | |
# mapping semver tags to networks | |
# v{MAJOR}.{MINOR}.{PATCH}-alpha -> alphanet | |
# v{MAJOR}.{MINOR}.{PATCH}-beta -> devnet | |
# v{MAJOR}.{MINOR}.{PATCH}-rc -> testnet | |
# v{MAJOR}.{MINOR}.{PATCH} -> mainnet | |
tags: | | |
type=raw,value={{sha}},enable=${{ github.event_name == 'workflow_dispatch' }} | |
type=raw,value=latest,enable=${{ github.event_name == 'workflow_dispatch' }} | |
type=raw,value={{tag}},enable=${{ github.event_name == 'release' }} | |
type=raw,value=alphanet,enable=${{ github.event_name == 'release' && contains(github.ref, '-alpha') }} | |
type=raw,value=devnet,enable=${{ github.event_name == 'release' && contains(github.ref, '-beta') }} | |
type=raw,value=testnet,enable=${{ github.event_name == 'release' && contains(github.ref, '-rc') }} | |
type=raw,value=mainnet,enable=${{ github.event_name == 'release' && !contains(github.ref, '-alpha') && !contains(github.ref, '-beta') && !contains(github.ref, '-rc') }} | |
- name: Login to Docker Registry | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # pin@v3 | |
with: | |
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }} | |
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }} | |
registry: ${{ secrets.DOCKER_REGISTRY_URL }} | |
# TODO: Remove when iota-sim is public https://github.com/iotaledger/iota/issues/2149 | |
- name: Set up SSH | |
uses: MrSquaare/ssh-setup-action@2d028b70b5e397cf8314c6eaea229a6c3e34977a # pin@v3 | |
with: | |
host: github.com | |
private-key: ${{ secrets.SSH_PRIVATE_KEY_IOTA_CI }} | |
private-key-name: github-ppk | |
- name: Build and push Docker image for iota-tools | |
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # pin@v6 | |
with: | |
ssh: default | |
context: . | |
file: docker/iota-tools/Dockerfile | |
build-args: | | |
RUST_IMAGE_VERSION=${{ env.TOOLCHAIN_VERSION }}-bookworm | |
platforms: linux/amd64 | |
tags: ${{ steps.meta-tools.outputs.tags }} | |
push: true | |
pull: true | |
build-iota-graphql-rpc: | |
runs-on: self-hosted | |
environment: release | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # pin@v4 | |
- name: Read Rust toolchain version from TOML | |
id: read_toolchain | |
run: | | |
TOOLCHAIN_VERSION=$(grep -oE 'channel = "[^"]+' ./rust-toolchain.toml | sed 's/channel = "//') | |
echo "TOOLCHAIN_VERSION=${TOOLCHAIN_VERSION}" >> $GITHUB_ENV | |
- name: Log Rust toolchain version | |
run: echo "Rust toolchain version is ${{ env.TOOLCHAIN_VERSION }}" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # pin@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # pin@v3 | |
- name: Docker meta for iota-graphql-rpc | |
id: meta-tools | |
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # pin@v5 | |
with: | |
images: docker-registry.iota.org/iota-graphql-rpc | |
# mapping semver tags to networks | |
# v{MAJOR}.{MINOR}.{PATCH}-alpha -> alphanet | |
# v{MAJOR}.{MINOR}.{PATCH}-beta -> devnet | |
# v{MAJOR}.{MINOR}.{PATCH}-rc -> testnet | |
# v{MAJOR}.{MINOR}.{PATCH} -> mainnet | |
tags: | | |
type=raw,value={{sha}},enable=${{ github.event_name == 'workflow_dispatch' }} | |
type=raw,value=latest,enable=${{ github.event_name == 'workflow_dispatch' }} | |
type=raw,value={{tag}},enable=${{ github.event_name == 'release' }} | |
type=raw,value=alphanet,enable=${{ github.event_name == 'release' && contains(github.ref, '-alpha') }} | |
type=raw,value=devnet,enable=${{ github.event_name == 'release' && contains(github.ref, '-beta') }} | |
type=raw,value=testnet,enable=${{ github.event_name == 'release' && contains(github.ref, '-rc') }} | |
type=raw,value=mainnet,enable=${{ github.event_name == 'release' && !contains(github.ref, '-alpha') && !contains(github.ref, '-beta') && !contains(github.ref, '-rc') }} | |
- name: Login to Docker Registry | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # pin@v3 | |
with: | |
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }} | |
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }} | |
registry: ${{ secrets.DOCKER_REGISTRY_URL }} | |
# TODO: Remove when iota-sim is public https://github.com/iotaledger/iota/issues/2149 | |
- name: Set up SSH | |
uses: MrSquaare/ssh-setup-action@2d028b70b5e397cf8314c6eaea229a6c3e34977a # pin@v3 | |
with: | |
host: github.com | |
private-key: ${{ secrets.SSH_PRIVATE_KEY_IOTA_CI }} | |
private-key-name: github-ppk | |
- name: Build and push Docker image for iota-graphql-rpc | |
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # pin@v6 | |
with: | |
ssh: default | |
context: . | |
file: docker/iota-graphql-rpc/Dockerfile | |
build-args: | | |
RUST_IMAGE_VERSION=${{ env.TOOLCHAIN_VERSION }}-bookworm | |
platforms: linux/amd64 | |
tags: ${{ steps.meta-tools.outputs.tags }} | |
push: true | |
pull: true |