-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (47 loc) · 1.72 KB
/
docker-release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
on:
push:
tags:
- release/*
branches:
- ekw/SRE-1004/*
jobs:
release-base-image:
if: ${{ contains(github.ref_name, 'base-image') }}
runs-on: ubuntu-latest
environment: release
env:
IMAGE_NAME: "concordium/base"
DOCKERHUB_USERNAME: ${{secrets.DOCKERHUB_USERNAME}}
DOCKERHUB_TOKEN: ${{secrets.DOCKERHUB_TOKEN}}
RUST_VERSION: "1.73.0"
GHC_VERSION: "9.6.4"
steps:
- name: Get the Image tag
env:
TAG: ${{ github.ref_name }}
run: echo "IMAGE_TAG=${TAG##ekw/SRE-1004/release-*}" #run: echo "IMAGE_TAG=${TAG##release/base-image-*}" >> $GITHUB_ENV
- name: Check if image exist
run: |
set +e
docker manifest inspect ${{env.IMAGE_NAME}}:${{env.IMAGE_TAG}}
exitcode=$?
if [ $exitcode -eq "0" ]; then
echo "Error: ${{env.IMAGE_NAME}}:rust${{env.RUST_VERSION}}-ghc${{env.GHC_VERSION}} already exist"
exit 1
fi
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ env.DOCKERHUB_TOKEN }}
- name: Clone repo
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- name: build docker image
run: |
docker build --build-arg rust_version="${{env.RUST_VERSION}}" --build-arg ghc_version="${{env.GHC_VERSION}}" --label rust_version="${{env.RUST_VERSION}}" --label ghc_version="${{env.GHC_VERSION}}" -f "docker/base.Dockerfile" -t "${{env.IMAGE_NAME}}:${{env.IMAGE_TAG}}" .
- name: Push docker image
run: |
echo ${{env.IMAGE_TAG}}
# docker push ${{env.IMAGE_NAME}}:${{env.IMAGE_TAG}}