Skip to content

Commit

Permalink
[action] merge isis-asp jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
chbrandt committed Nov 3, 2023
1 parent f6f600a commit 5d15bfc
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 49 deletions.
112 changes: 65 additions & 47 deletions .github/workflows/docker_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,64 +156,78 @@ jobs:
| grep "${{ env.REPO }}"
| xargs -I'{}' docker push {}
- name: Save image
# - name: Save image
# run: |
# NEW_IMAGE=`docker compose config --images ${{ env.SERVICE }}`
# docker save --output /tmp/image.tar $NEW_IMAGE

# - name: Upload artifact
# uses: actions/upload-artifact@v3
# with:
# name: isis_image
# path: /tmp/image.tar

# - name: List images
# run: |
# docker image ls -a


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

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

# - name: Download artifact
# uses: actions/download-artifact@v3
# with:
# name: isis_image
# path: /tmp

# - name: Load image
# run: |
# docker load --input /tmp/image.tar
# docker image ls -a

# - name: Load .env file
# uses: xom9ikk/dotenv@v2

- name: Redefine ENV for isis-asp
run: |
NEW_IMAGE=`docker compose config --images ${{ env.SERVICE }}`
docker save --output /tmp/image.tar $NEW_IMAGE
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: isis_image
path: /tmp/image.tar

- name: List images
run: |
docker image ls -a
isis-asp:
needs: isis
runs-on: ubuntu-latest
env:
USER_ORG: ${{ vars.DOCKERHUB_USERNAME }}
SERVICE: jupyter-isis-asp
REPO: ${USER_ORG}/${SERVICE}

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

- name: Download artifact
uses: actions/download-artifact@v3
with:
name: isis_image
path: /tmp

- name: Load image
run: |
docker load --input /tmp/image.tar
docker image ls -a
- name: Load .env file
uses: xom9ikk/dotenv@v2
SERVICE="${{ env.SERVICE }}-asp"
REPO="${{ env.USER_ORG }}/$SERVICE"
echo "SERVICE=$SERVICE" >> $GITHUB_ENV
echo "REPO=$REPO" >> $GITHUB_ENV
- name: Build image
run: |
docker compose build ${{ env.SERVICE }}
docker compose build ${SERVICE}
# docker compose build ${{ env.SERVICE }}

- name: Tag image
if: ${{ github.event_name == 'push' }}
run: |
NEW_IMAGE=`docker compose config --images ${{ env.SERVICE }}`
docker tag $NEW_IMAGE ${{ env.REPO }}:$GITHUB_REF_NAME
NEW_IMAGE=`docker compose config --images ${SERVICE}`
docker tag $NEW_IMAGE ${REPO}:$GITHUB_REF_NAME
# NEW_IMAGE=`docker compose config --images ${{ env.SERVICE }}`
# docker tag $NEW_IMAGE ${{ env.REPO }}:$GITHUB_REF_NAME

- name: Tag 'latest' image
if: ${{ github.ref_type == 'tag' }}
run: |
NEW_IMAGE=`docker compose config --images ${{ env.SERVICE }}`
docker tag $NEW_IMAGE ${{ env.REPO }}:latest
docker tag $NEW_IMAGE ${{ env.REPO }}:${ISIS_VERSION}-${ASP_VERSION}
NEW_IMAGE=`docker compose config --images ${SERVICE}`
docker tag $NEW_IMAGE ${REPO}:latest
docker tag $NEW_IMAGE ${REPO}:${ISIS_VERSION}-${ASP_VERSION}
# NEW_IMAGE=`docker compose config --images ${{ env.SERVICE }}`
# docker tag $NEW_IMAGE ${{ env.REPO }}:latest
# docker tag $NEW_IMAGE ${{ env.REPO }}:${ISIS_VERSION}-${ASP_VERSION}
# DATE=`date +%Y%m%d`
# docker tag $NEW_IMAGE ${{ env.REPO }}:$DATE

Expand All @@ -234,5 +248,9 @@ jobs:
run: >
docker image ls
| tail -n+2 | awk '{print $1":"$2}'
| grep "${{ env.REPO }}"
| grep "${REPO}"
| xargs -I'{}' docker push {}
# docker image ls
# | tail -n+2 | awk '{print $1":"$2}'
# | grep "${{ env.REPO }}"
# | xargs -I'{}' docker push {}
4 changes: 2 additions & 2 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ services:
dockerfile: isis.dockerfile
args:
BASE_IMAGE: ${ISIS_BASE_IMAGE:-jupyter/minimal-notebook}
ISIS_VERSION: ${ISIS_VERSION:-7.1.0}
ISIS_VERSION: ${ISIS_VERSION:?Set a valid ISIS_VERSION (eg, 7.1.0)}
ISISDATA: ${ISISDATA:-/isis/data}
ISISTESTDATA: ${ISISTESTDATA:-/isis/testdata}
image: ${ISIS_IMAGE:-jupyter-isis}
Expand All @@ -32,7 +32,7 @@ services:
dockerfile: isisasp.dockerfile
args:
BASE_IMAGE: ${ISIS_IMAGE:-jupyter-isis}
ASP_VERSION: ${ASP_VERSION:-3.2.0}
ASP_VERSION: ${ASP_VERSION:?Set a valid ASP_VERSION (eg, 3.2.0)}
image: ${ASP_IMAGE:-jupyter-isis-asp}
ports:
- 8888:8888

0 comments on commit 5d15bfc

Please sign in to comment.