This repository has been archived by the owner on Nov 29, 2024. It is now read-only.
Update Dockerfile-test #3
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
name: Push Docker Image | |
on: | |
push: | |
tags: | |
- '*' | |
env: | |
TAG: "conda-lter-life" | |
DOCKERHUB_IMAGE_ID: "qcdis/" | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Login to github Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: "https://index.docker.io/v1/" | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Build and push to container Registry | |
run: | | |
docker build . --file Dockerfile -t $TAG | |
# Change all uppercase to lowercase | |
IMAGE_ID=$DOCKERHUB_IMAGE_ID$TAG | |
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
# Strip git ref prefix from version | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
echo IMAGE_ID=$IMAGE_ID | |
echo VERSION=$VERSION | |
docker tag $TAG $IMAGE_ID:$VERSION | |
docker push $IMAGE_ID:$VERSION | |
docker tag $TAG $IMAGE_ID:latest | |
docker push $IMAGE_ID:latest |