-
Notifications
You must be signed in to change notification settings - Fork 1
90 lines (78 loc) · 2.72 KB
/
dockerimgs.yml
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: '[docker image]'
on:
push:
branches:
- feat_workerFrontend
# release:
# types:
# - published
jobs:
build-docker-img:
runs-on: ubuntu-latest
strategy:
matrix:
dockerfile: ['./http.server.dockerfile', './http.worker.dockerfile']
include:
- dockerfile: ./http.server.dockerfile
dockerimg: siibra-jugex-server
- dockerfile: ./http.worker.dockerfile
dockerimg: siibra-jugex-worker
steps:
- uses: actions/checkout@v2
- name: 'Setup tags'
run: |
VERSION=$(grep -Po '^__version__.*?"\K[\w.]+' http_wrapper/__init__.py)
echo "Setting version to $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
DOCKER_IMGSTREAM=${{ secrets.EBRAINS_DOCKER_REG_SIIBRA_TOOLBOX_NSP }}/${{ matrix.dockerimg }}
echo "Setting docker image stream to $DOCKER_IMGSTREAM"
echo "DOCKER_IMGSTREAM=$DOCKER_IMGSTREAM" >> $GITHUB_ENV
- name: 'Build docker image'
run: |
DOCKER_BUILT_TAG=$DOCKER_IMGSTREAM:$VERSION
echo "Building $DOCKER_BUILT_TAG"
docker build \
-t $DOCKER_BUILT_TAG \
-f ${{ matrix.dockerfile }} \
.
echo "Successfully built $DOCKER_BUILT_TAG"
echo "DOCKER_BUILT_TAG=$DOCKER_BUILT_TAG" >> $GITHUB_ENV
- name: 'Push to docker registry'
run: |
echo "Login to docker registry"
docker login \
-u '${{ secrets.EBRAINS_DOCKER_REG_SIIBRA_TOOLBOX_PUSHER_USER }}' \
-p '${{ secrets.EBRAINS_DOCKER_REG_SIIBRA_TOOLBOX_PUSHER_PWSD }}' \
${{ secrets.EBRAINS_DOCKER_REG }}
echo "Pushing $DOCKER_BUILT_TAG"
docker push $DOCKER_BUILT_TAG
- name: 'Tag versioned tag to registry'
run: |
echo "Login to docker registry"
docker login \
-u '${{ secrets.EBRAINS_DOCKER_REG_SIIBRA_TOOLBOX_PUSHER_USER }}' \
-p '${{ secrets.EBRAINS_DOCKER_REG_SIIBRA_TOOLBOX_PUSHER_PWSD }}' \
${{ secrets.EBRAINS_DOCKER_REG }}
BREAK=5
while [[ "$VERSION" == *"."* ]]
do
if [[ "$BREAK" == "0" ]]
then
echo "Fuse broke!"
exit 1
fi
VERSIONED_DOCKERTAG=$DOCKER_IMGSTREAM:$VERSION
echo "tagging and pushing $VERSIONED_DOCKERTAG"
docker tag $DOCKER_BUILT_TAG $VERSIONED_DOCKERTAG
docker push $VERSIONED_DOCKERTAG
echo "Push successful... Incrementing version & break"
VERSION=$(echo $VERSION | sed -e 's/\.\w*$//g')
BREAK=$(( "$BREAK" - 1 ))
done
echo "Done"
deploy-on-ebrains:
runs-on: ubuntu-latest
needs: build-docker-img
steps:
- name: "skip for now"
run: "echo skip for now"