Build and publish the docker image #96
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
# SPDX-FileCopyrightText: 2022 Renaissance Computing Institute. All rights reserved. | |
# SPDX-FileCopyrightText: 2023 Renaissance Computing Institute. All rights reserved. | |
# SPDX-FileCopyrightText: 2024 Renaissance Computing Institute. All rights reserved. | |
# | |
# SPDX-License-Identifier: GPL-3.0-or-later | |
# SPDX-License-Identifier: LicenseRef-RENCI | |
# SPDX-License-Identifier: MIT | |
name: Build and publish the docker image | |
# trigger event is publishing a release in the repo | |
on: | |
release: | |
types: [published] | |
# working parameters that are specific to this script | |
env: | |
REGISTRY: containers.renci.org/eds/apsviz-ui-data | |
# job definition | |
jobs: | |
Build-and-publish-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
# job steps | |
steps: | |
# checkout the codebase | |
- name: Checkout | |
uses: actions/checkout@v1 | |
# connect to the renci image registry | |
- name: Login to containers.renci.org | |
uses: docker/login-action@v2 | |
with: | |
registry: containers.renci.org | |
username: ${{ secrets.USER }} | |
password: ${{ secrets.PW }} | |
# get the tag for the image | |
- name: Get the version | |
id: get_version | |
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT | |
# build and push the image. The docker v3 action automatically handles the git checkout. | |
- name: Build/Push the image to the registry | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
build-args: | | |
APP_VERSION=${{ steps.get_version.outputs.VERSION }} | |
tags: | | |
${{ env.REGISTRY }}:latest | |
${{ env.REGISTRY }}:${{ steps.get_version.outputs.VERSION }} | |
# push the image to AWS/ECR | |
- name: Push the built image to the AWS/ECR registry | |
id: ecr | |
uses: jwalton/gh-ecr-push@v1 | |
with: | |
access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
region: us-east-2 | |
local-image: ${{ env.REGISTRY }}:${{ steps.get_version.outputs.VERSION }} | |
image: apsviz-ui-data:latest, apsviz-ui-data:${{ steps.get_version.outputs.VERSION }} |