generated from IQTLabs/edgetech-template
-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (55 loc) · 1.71 KB
/
dockerbuild.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
name: Container Processing
on:
push:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get tag
id: get_tag
run: |
echo "::set-output name=IMAGE_TAG::$(echo $GITHUB_REF | cut -d / -f 3)"
- name: Set up qemu
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
- name: Docker Login
run: echo "${{ secrets.DOCKER_TOKEN }}" | docker login --username "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Get Changes
id: identify
uses: jitterbit/get-changed-files@v1
- run: |
echo ${{ steps.files.output.all }}
- name: Build Images
env:
# Every folder in the repo that has a Dockerfile within it, comma separated
DOCKERFOLDERS: "skyscan-c2"
DOCKERNAMESPACE: ${{ secrets.DOCKER_NAMESPACE }}
PROJECT_NAME: "edgetech"
run: |
IFS=","
read -ra ARR <<< "$DOCKERFOLDERS"
for folder in "${ARR[@]}"
do
IFS="/"
read -ra NAMEFOLDER <<< $folder
SUBNAME=${NAMEFOLDER[0]}
PUBLISHNAME=""
if [ $NAMEFOLDER != $SUBNAME ]; then
PUBLISHNAME=$PROJECT_NAME-$folder-$SUBNAME
else
PUBLISHNAME=$PROJECT_NAME-$folder
fi
echo "Building $folder"
docker buildx build "$folder" --push \
--tag $DOCKERNAMESPACE/$PUBLISHNAME:latest \
--tag $DOCKERNAMESPACE/$PUBLISHNAME:${{ steps.get_tag.outputs.IMAGE_TAG }} \
--platform linux/arm64,linux/amd64
done