Skip to content

Commit

Permalink
Update docker_build
Browse files Browse the repository at this point in the history
  • Loading branch information
chbrandt committed Oct 31, 2023
1 parent 6b09647 commit 39b0438
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions .github/workflows/docker_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,27 +53,42 @@ jobs:

gispy:
runs-on: ubuntu-latest
env:
USER_ORG: ${{ vars.DOCKERHUB_USERNAME }}
SERVICE: jupyter-isis
REPO: ${USER_ORG}/${SERVICE}

steps:
- # https://github.com/marketplace/actions/checkout
name: Checkout
uses: actions/checkout@v4

- name: Build image
run: |
docker compose -f compose.build.yml build jupyter-gispy
docker compose -f compose.build.yml build $SERVICE
- name: List images
run: docker image ls -a

- name: Tag image
if: ${{ github.event_name == 'push' }}
env:
USERNAME: ${{ vars.DOCKERHUB_USERNAME }}
run: |
NEW_IMAGE=`docker compose -f compose.build.yml config --images jupyter-gispy`
docker tag $NEW_IMAGE ${USERNAME}/jupyter-gispy:$GITHUB_REF_NAME
# IMAGE_SHA=`docker images -q $NEW_IMAGE`
# docker tag $NEW_IMAGE ${USERNAME}/jupyter-gispy:$IMAGE_SHA
NEW_IMAGE=`docker compose -f compose.build.yml config --images $SERVICE`
docker tag $NEW_IMAGE ${REPO}:$GITHUB_REF_NAME
- name: Tag 'latest' image
if: ${{ github.ref_type == 'tag' }}
run: |
NEW_IMAGE=`docker compose -f compose.build.yml config --images $SERVICE`
DATE=`date +%Y%m%d`
docker tag $NEW_IMAGE ${REPO}:latest
docker tag $NEW_IMAGE ${REPO}:$DATE
# - name: Tag image with SHA hash
# if: ${{ github.event_name == 'push' }}
# run: |
# IMAGE_SHA=`docker images -q $NEW_IMAGE`
# docker tag $NEW_IMAGE ${USERNAME}/jupyter-gispy:$IMAGE_SHA

- name: List images
run: docker image ls -a
Expand All @@ -86,10 +101,8 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Push image
env:
USERNAME: ${{ vars.DOCKERHUB_USERNAME }}
run: >
docker image ls
| tail -n+2 | awk '{print $1":"$2}'
| grep "${USERNAME}/jupyter-gispy"
| tail -n+2 | awk '{print $1":"$2}'
| grep "${REPO}"
| xargs -I'{}' docker push {}

0 comments on commit 39b0438

Please sign in to comment.