Skip to content

update pangeo base image to 2024.06.28 #24

update pangeo base image to 2024.06.28

update pangeo base image to 2024.06.28 #24

name: Build and push container image
on:
workflow_dispatch:
push:
branches:
- "**" # Push to any branch
paths-ignore:
- "README.md"
- "LICENSE"
pull_request:
branches:
- main
env:
REGISTRY: public.ecr.aws
NAMESPACE: nasa-veda
IMAGE_NAME: pangeo-notebook-veda-image
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
install: true
- name: Configure AWS Credentials
if: github.event_name == 'push'
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Login to Amazon ECR Public
if: github.event_name == 'push'
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
with:
registry-type: public
- uses: int128/create-ecr-repository-action@v1
if: github.event_name == 'push'
with:
repository: ${{ env.IMAGE_NAME}}
public: true
- name: Build container image
uses: jupyterhub/repo2docker-action@master
with:
DOCKER_REGISTRY: ${{ env.REGISTRY }}
IMAGE_NAME: ${{ env.NAMESPACE }}/${{ env.IMAGE_NAME }}
REPO_DIR: /srv/repo
# Don't push because pushes to the public ECR repository seem to fail
NO_PUSH: "true"
- name: Push to Amazon ECR
if: github.event_name == 'push'
run: |
short_sha=$(echo ${{ github.sha }} | cut -c1-12)
docker push ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ env.IMAGE_NAME }}:${short_sha}
- name: Push latest tag to Amazon ECR from main branch
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: |
docker push ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ env.IMAGE_NAME }}:latest