Skip to content

Commit 699d2d5

Browse files
committed
Workflow updates.
1 parent 74a45e3 commit 699d2d5

File tree

2 files changed

+56
-69
lines changed

2 files changed

+56
-69
lines changed
Lines changed: 26 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
name: docker-jupyter-hub-hybrid-architecture
22

33
on:
4-
54
push:
65
branches: ['**']
76
tags: ['v*.*.*']
87
pull_request:
98
branches: ['**']
109
release:
1110
types: [published]
12-
13-
# Allows you to run this workflow manually from the Actions tab
1411
workflow_dispatch:
1512

1613
jobs:
17-
1814
build:
19-
2015
runs-on: ${{ matrix.runner }}
21-
2216
strategy:
2317
matrix:
2418
platform: [amd64, arm64]
@@ -27,52 +21,43 @@ jobs:
2721
runner: ubuntu-22.04
2822
- platform: arm64
2923
runner: ubuntu-22.04-arm
30-
31-
env:
32-
working-directory: ./
3324

34-
# Steps represent a sequence of tasks that will be executed as part of the job
3525
steps:
26+
- name: Checkout repo
27+
uses: actions/checkout@v3
28+
3629
- name: Set up QEMU
3730
uses: docker/setup-qemu-action@v3
38-
31+
3932
- name: Set up Docker Buildx
4033
uses: docker/setup-buildx-action@v3
41-
42-
- name: checkout repo
43-
uses: actions/checkout@v3
44-
34+
4535
- name: Log in to Docker Hub
4636
if: ${{ github.actor != 'dependabot[bot]' }}
4737
uses: docker/login-action@v3
4838
with:
4939
username: ${{ secrets.DOCKER_HUB_USERNAME }}
5040
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
51-
52-
- name: Extract metadata (tags, labels) for Docker
53-
id: meta
54-
uses: docker/metadata-action@v5
55-
with:
56-
images: cogstacksystems/jupyter-hub:latest
57-
58-
- name: Get and set release version env var
59-
id: release_version
60-
run: |
61-
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
62-
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_OUTPUT
63-
64-
- name: set docker release tag name
65-
id: set_release_version_latest
66-
if: ${{ github.ref == 'refs/heads/main' }}
67-
run: echo "RELEASE_VERSION=latest" >> $GITHUB_ENV
68-
69-
- name: set CPU architecture
70-
id: set_cpu_architecture
71-
run: echo "CPU_ARCHITECTURE=${{ matrix.platform }}" >> $GITHUB_ENV
7241

73-
- name: Build and push Docker Jupyter Hub image
42+
- name: Compute release tag
43+
id: release_version
7444
run: |
75-
docker build --platform linux/${{ matrix.platform }} -t cogstacksystems/jupyter-hub:$RELEASE_VERSION-${{ matrix.platform }} -f Dockerfile_hub --build-arg CPU_ARCHITECTURE=${{ matrix.platform }} .
76-
docker push cogstacksystems/jupyter-hub:$RELEASE_VERSION-${{ matrix.platform }}
77-
DIGEST=$(docker images --digests --format '{{.Digest}}' cogstacksystems/jupyter-hub | head -n 1)
78-
echo "digest=$DIGEST" >> $GITHUB_OUTPUT
45+
if [[ "${GITHUB_REF#refs/heads/}" == "${GITHUB_REF}" ]]; then
46+
VERSION="${GITHUB_REF#refs/*/}"
47+
else
48+
VERSION="latest"
49+
fi
50+
echo "RELEASE_VERSION=$VERSION" >> "$GITHUB_ENV"
51+
echo "release_version=$VERSION" >> "$GITHUB_OUTPUT"
52+
53+
- name: Build and push Jupyter Hub image
54+
uses: docker/build-push-action@v6
55+
with:
56+
context: ./
57+
platforms: linux/${{ matrix.platform }}
58+
file: Dockerfile_hub
59+
build-args: |
60+
CPU_ARCHITECTURE=${{ matrix.platform }}
61+
tags: |
62+
cogstacksystems/jupyter-hub:${{ steps.release_version.outputs.release_version }}-${{ matrix.platform }}
63+
push: ${{ github.actor != 'dependabot[bot]' }}
Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
name: docker-jupyter-singleuser-cpu-gpu-hybrid-architecture
22

33
on:
4-
54
push:
65
branches: ['**']
76
tags: ['v*.*.*']
87
pull_request:
98
branches: ['**']
109
release:
1110
types: [published]
12-
13-
# Allows you to run this workflow manually from the Actions tab
1411
workflow_dispatch:
1512

1613
jobs:
@@ -23,44 +20,28 @@ jobs:
2320
uses: actions/checkout@v3
2421
with:
2522
submodules: true
23+
2624
- name: Git Submodule Update
2725
run: |
28-
git submodule update --init --recursive
29-
git pull --recurse-submodules origin main
30-
git submodule update --remote --recursive
31-
32-
- name: Log in to Docker Hub
33-
if: ${{ github.actor != 'dependabot[bot]' }}
34-
uses: docker/login-action@v3
35-
with:
36-
username: ${{ secrets.DOCKER_HUB_USERNAME }}
37-
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
26+
git submodule update --init --remote --recursive
3827
3928
- name: Metadata for Docker
4029
id: meta
4130
uses: docker/metadata-action@v5
4231
with:
43-
images: |
44-
cogstacksystems/jupyter-singleuser:latest
32+
images: cogstacksystems/jupyter-singleuser:latest
33+
4534
- name: Get and Set Release Version
4635
id: release_version
4736
run: |
4837
if [[ "${GITHUB_REF#refs/heads/}" == "${GITHUB_REF}" ]]; then
49-
# it's a tag or something else
5038
VERSION="${GITHUB_REF#refs/*/}"
5139
else
5240
VERSION="latest"
5341
fi
5442
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
5543
echo "release_version=$VERSION" >> $GITHUB_OUTPUT
5644
57-
- name: Tag Setup
58-
run: |
59-
if [[ "${RELEASE_VERSION}" == "main" ]]; then
60-
echo "RELEASE_VERSION=latest" >> $GITHUB_ENV
61-
else
62-
echo "RELEASE_VERSION=${RELEASE_VERSION#?}" >> $GITHUB_ENV
63-
fi
6445
build-cpu:
6546
needs: setup
6647
runs-on: ubuntu-22.04
@@ -70,8 +51,17 @@ jobs:
7051
steps:
7152
- name: Checkout
7253
uses: actions/checkout@v3
54+
55+
- name: Log in to Docker Hub
56+
if: ${{ github.actor != 'dependabot[bot]' }}
57+
uses: docker/login-action@v3
58+
with:
59+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
60+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
61+
7362
- name: Set up Docker Buildx
7463
uses: docker/setup-buildx-action@v3
64+
7565
- name: Build and Push CPU Image
7666
uses: docker/build-push-action@v6
7767
with:
@@ -80,20 +70,32 @@ jobs:
8070
build-args: |
8171
CPU_ARCHITECTURE=${{ matrix.platform }}
8272
tags: cogstacksystems/jupyter-singleuser:${{ needs.setup.outputs.release_version }}-${{ matrix.platform }}
83-
push: true
73+
push: ${{ github.actor != 'dependabot[bot]' }}
8474

8575
build-gpu:
8676
needs: setup
8777
runs-on: ubuntu-22.04
8878
steps:
79+
- name: Checkout
80+
uses: actions/checkout@v3
81+
82+
- name: Log in to Docker Hub
83+
if: ${{ github.actor != 'dependabot[bot]' }}
84+
uses: docker/login-action@v3
85+
with:
86+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
87+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
88+
89+
- name: Set up Docker Buildx
90+
uses: docker/setup-buildx-action@v3
91+
8992
- name: Build and Push GPU Image
9093
uses: docker/build-push-action@v6
9194
with:
92-
context: ${{ env.CONTEXT }}
95+
context: ./
9396
platforms: linux/amd64
9497
file: Dockerfile_singleuser_gpu
9598
build-args: |
9699
CPU_ARCHITECTURE=amd64
97-
tags: |
98-
cogstacksystems/jupyter-singleuser-gpu:${{ needs.setup.outputs.release_version }}-amd64
99-
push: true
100+
tags: cogstacksystems/jupyter-singleuser-gpu:${{ needs.setup.outputs.release_version }}-amd64
101+
push: ${{ github.actor != 'dependabot[bot]' }}

0 commit comments

Comments
 (0)