Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 71 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,74 @@ jobs:
src/build/release/ocf-amd64
src/build/release/ocf-arm64
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish-docker-images:
runs-on: ubuntu-22.04
needs: build
strategy:
fail-fast: false
matrix:
include:
- dockerfile: ./docker/dispatcher/Dockerfile
image: ocf
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get release version
id: get_version
run: |
echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Checkout release tag
run: |
git fetch --tags --all --force
git checkout tags/${{ env.RELEASE_TAG }}

# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
with:
images: ${{ env.REGISTRY }}/${{ matrix.image }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: .
file: ${{ matrix.dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }}
platforms: linux/amd64,linux/arm64
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
VERSION=${{ env.RELEASE_TAG }}
19 changes: 19 additions & 0 deletions docker/dispatcher/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

FROM alpine:edge

ARG VERSION

WORKDIR /app

RUN case "$TARGETPLATFORM" in \
"linux/amd64") URL="https://github.com/ResearchComputer/OpenComputeFramework/releases/download/${{VERSION}}/ocf-amd64" ;; \
"linux/arm64") URL="https://github.com/ResearchComputer/OpenComputeFramework/releases/download/${{VERSION}}/ocf-arm64" ;; \
*) echo "Unsupported platform: $TARGETPLATFORM" && exit 1 ;; \
esac && \
curl -L "$URL" > ocf && \
chmod +x ocf


RUN apk --no-cache add ca-certificates tzdata

ENTRYPOINT ["/app/ocf"]
Loading