Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Provide ready-to-use Docker images #35

Open
CDDelta opened this issue Mar 11, 2021 · 2 comments
Open

Provide ready-to-use Docker images #35

CDDelta opened this issue Mar 11, 2021 · 2 comments
Labels
enhancement New feature or request next release Tasked for next released

Comments

@CDDelta
Copy link

CDDelta commented Mar 11, 2021

Same thing as ArweaveTeam/testweave-docker#3

It would be very helpful to have the container image ready to use just by running docker pull. The image can be stored along with this repo using the GitHub Container Registry which is free for OSS.

A GitHub action can be set up to build the image every time a GitHub release is created.

Something like the below will be sufficient. I can't set this up as someone from the team will need to provide a credential for pushing the image to the repo.

For setting up CR_PAT: https://docs.github.com/en/packages/guides/migrating-to-github-container-registry-for-docker-images#authenticating-with-the-container-registry

name: Build Release

on:
  release:
    types: [created]

jobs:
  build_image:
    name: Build image
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          ref: ${{ github.head_ref }}
      - name: Cache Docker layers
        uses: actions/cache@v2
        with:
          path: /tmp/.buildx-cache
          key: ${{ runner.os }}-buildx-${{ github.sha }}
          restore-keys: |
            ${{ runner.os }}-buildx-
      - name: Login to GitHub Container Registry
        uses: docker/login-action@v1
        with:
          registry: ghcr.io
          username: ${{ github.repository_owner }}
          password: ${{ secrets.CR_PAT }}   <- The repo owner needs to generate a credential for pushing to the registry
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1
      - name: Build and push image
        id: docker_build
        uses: docker/build-push-action@v2
        with:
          context: .
          file: ./docker/gateway.dockerfile
          push: true
          tags: |
            ghcr.io/ArweaveTeam/gateway:latest
            ghcr.io/ArweaveTeam/gateway:${{ github.event.release.tag_name }}
          cache-from: type=local,src=/tmp/.buildx-cache
          cache-to: type=local,dest=/tmp/.buildx-cache
      - name: Image digest
        run: echo ${{ steps.docker_build.outputs.digest }}
@CDDelta
Copy link
Author

CDDelta commented Mar 11, 2021

Also please bind the resulting container images to the repo for ease of access 😄
https://docs.github.com/en/packages/guides/connecting-a-repository-to-a-container-image

@TheLoneRonin TheLoneRonin added backlog Backlogged deliverables enhancement New feature or request next release Tasked for next released and removed backlog Backlogged deliverables labels Mar 17, 2021
@CDDelta
Copy link
Author

CDDelta commented Apr 3, 2021

Instead of using a personal access token, with some config you can now use the built-in GITHUB_TOKEN to authenticate to ghcr.io from GitHub Actions 😄

https://docs.github.com/en/packages/guides/using-github-packages-with-github-actions#upgrading-a-workflow-that-accesses-ghcrio

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request next release Tasked for next released
Projects
None yet
Development

No branches or pull requests

2 participants