-
Notifications
You must be signed in to change notification settings - Fork 1
105 lines (102 loc) · 3.72 KB
/
foxy pc.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: foxy pc
on:
push:
branches:
- 'main'
- 'dev'
tags:
- v*
workflow_dispatch:
jobs:
foxy-pc:
runs-on: ubuntu-latest
env:
REPO: https://github.com/${{ github.repository }}
FROM_SRC_IMAGE: ghcr.io/${{ github.repository_owner }}/src-ros2
DOCKER_REPO_1: ghcr.io/${{ github.repository_owner }}/core-foxy-pc
DOCKER_REPO_2: ghcr.io/${{ github.repository_owner }}/base-foxy-pc
DOCKER_REPO_3: ghcr.io/${{ github.repository_owner }}/runtime-foxy-pc
DOCKER_REPO_4: ghcr.io/${{ github.repository_owner }}/build-foxy-pc
DOCKER_REPO_5: ghcr.io/${{ github.repository_owner }}/devel-foxy-pc
steps:
-
name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_TOKEN }}
-
name: Checkout
uses: actions/checkout@v2
-
name: Get VER
id: ver
run: |
ver=$(git describe --exact-match --tags $(git log -n1 --pretty='%h')) || ver=latest
export VER=$ver
echo ::set-output name=VER::$VER
-
name: Get SHA
id: sha
run: |
sha=$(git rev-list --max-count=1 HEAD)
export SHA=$sha
echo ::set-output name=SHA::$SHA
-
name: Build and push the core docker image
run: |
TAG=${{ steps.ver.outputs.VER }}
TAGS="--tag ${DOCKER_REPO_1}"
if [ $TAG != latest ]; then
TAGS="$TAGS --tag ${DOCKER_REPO_1}:${TAG}"
fi
docker build . --file core.dockerfile ${TAGS} --build-arg REPO=$REPO --build-arg VER=${{ steps.ver.outputs.VER }} --build-arg SHA=${{ steps.sha.outputs.SHA }} --build-arg FROM_IMAGE=nvidia/cudagl:11.1-runtime-ubuntu20.04
docker push ${DOCKER_REPO_1}
docker push ${DOCKER_REPO_1}:${TAG}
-
name: Build and push the base docker image
run: |
TAG=${{ steps.ver.outputs.VER }}
TAGS="--tag ${DOCKER_REPO_2}"
if [ $TAG != latest ]; then
TAGS="$TAGS --tag ${DOCKER_REPO_2}:${TAG}"
fi
docker build . --file base.foxy.dockerfile ${TAGS} --build-arg FROM_IMAGE=$DOCKER_REPO_1
docker push ${DOCKER_REPO_2}
docker push ${DOCKER_REPO_2}:${TAG}
-
name: Build and push the runtime docker image
run: |
TAG=${{ steps.ver.outputs.VER }}
TAGS="--tag ${DOCKER_REPO_3}"
if [ $TAG != latest ]; then
TAGS="$TAGS --tag ${DOCKER_REPO_3}:${TAG}"
fi
docker build . --file runtime.foxy.dockerfile --tag tmp --build-arg FROM_IMAGE=$DOCKER_REPO_2
docker build . --file runtime.dockerfile ${TAGS} --build-arg FROM_IMAGE=tmp
docker push ${DOCKER_REPO_3}
docker push ${DOCKER_REPO_3}:${TAG}
-
name: Build and push the build docker image
run: |
TAG=${{ steps.ver.outputs.VER }}
TAGS="--tag ${DOCKER_REPO_4}"
if [ $TAG != latest ]; then
TAGS="$TAGS --tag ${DOCKER_REPO_4}:${TAG}"
fi
docker build . --file build.foxy.dockerfile --tag tmp --build-arg FROM_IMAGE=$DOCKER_REPO_3 --build-arg FROM_SRC_IMAGE=$FROM_SRC_IMAGE
docker build . --file build.dockerfile ${TAGS} --build-arg FROM_IMAGE=tmp
docker push ${DOCKER_REPO_4}
docker push ${DOCKER_REPO_4}:${TAG}
-
name: Build and push the devel docker image
run: |
TAG=${{ steps.ver.outputs.VER }}
TAGS="--tag ${DOCKER_REPO_5}"
if [ $TAG != latest ]; then
TAGS="$TAGS --tag ${DOCKER_REPO_5}:${TAG}"
fi
docker build . --file devel.dockerfile ${TAGS} --build-arg FROM_IMAGE=$DOCKER_REPO_4
docker push ${DOCKER_REPO_5}
docker push ${DOCKER_REPO_5}:${TAG}