Skip to content

Commit

Permalink
Merge pull request #2141 from mayankchetan/ghcr-actions
Browse files Browse the repository at this point in the history
GH actions to push docker image to Github container registry
  • Loading branch information
andrew-platt authored Apr 4, 2024
2 parents f03df27 + a56bcc8 commit 4ac6c8a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 8 deletions.
22 changes: 18 additions & 4 deletions .github/workflows/build-docker-image-automatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,30 @@ jobs:
env:
DOCKERFILE_PATH: share/docker/Dockerfile
DOCKERHUB_REPOSITORY: nrel/openfast
GH_REGISTRY: ghcr.io/OpenFAST/openfast
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to DockerHub
# Commenting out until we get the NREL DockerHub credentials
# - name: Log in to DockerHub
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
registry: ${{ env.GH_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract tag from release candidate branch name
id: extract-tag
Expand All @@ -42,7 +54,9 @@ jobs:
context: .
file: ${{ env.DOCKERFILE_PATH }}
platforms: linux/amd64,linux/aarch64
tags: ${{ env.DOCKERHUB_REPOSITORY }}:${{ steps.extract-tag.outputs.openfast-tag }},${{ env.DOCKERHUB_REPOSITORY }}:latest
tags: |
${{ env.GH_REGISTRY }}:${{ steps.extract-tag.outputs.openfast-tag }},${{ env.DOCKERHUB_REPOSITORY }}:latest
# ${{ env.DOCKERHUB_REPOSITORY }}:${{ steps.extract-tag.outputs.openfast-tag }},${{ env.DOCKERHUB_REPOSITORY }}:latest
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
22 changes: 18 additions & 4 deletions .github/workflows/build-docker-image-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ jobs:
DOCKERFILE_PATH: share/docker/Dockerfile
DOCKERFILE_PERMALINK: https://raw.githubusercontent.com/OpenFAST/openfast/main/share/docker/Dockerfile
DOCKERHUB_REPOSITORY: nrel/openfast
GH_REGISTRY: ghcr.io/OpenFAST/openfast
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -31,11 +35,19 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to DockerHub
# Commenting out until we get the NREL DockerHub credentials
# - name: Log in to DockerHub
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
registry: ${{ env.GH_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# The updated Dockerfile is only available in the repository at the tag v3.5.3 and above. To build versions of
# OpenFAST that are below this version, the updated Dockerfile from that tag of the repository has to be acquired
Expand All @@ -52,7 +64,9 @@ jobs:
context: .
file: ${{ env.DOCKERFILE_PATH }}
platforms: linux/amd64,linux/aarch64
tags: ${{ env.DOCKERHUB_REPOSITORY }}:${{ github.event.inputs.tag }}
tags: |
${{ env.GH_REGISTRY }}:${{ github.event.inputs.tag }}
# ${{ env.DOCKERHUB_REPOSITORY }}:${{ github.event.inputs.tag }}
push: true
cache-from: type=gha
cache-to: type=gha,mode=max

0 comments on commit 4ac6c8a

Please sign in to comment.