-
Notifications
You must be signed in to change notification settings - Fork 2
56 lines (48 loc) · 1.98 KB
/
build-test-container.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
# Copyright (C) 2023 Martin Scheiber,
# Control of Networked Systems, University of Klagenfurt, Austria.
#
# All rights reserved.
#
# This software is licensed under the terms of the BSD-2-Clause-License with
# no commercial use allowed, the full terms of which are made available
# in the LICENSE file. No license in patents is granted.
#
# You can contact the author at <[email protected]>.
name: Docker Container Build
on:
push:
branches: [ "main", "development" ]
paths:
- 'docker/**'
- '.github/workflows/build-test-container.yml'
jobs:
build_env_dev:
name: Build Test Container (${{ github.ref_name }})
runs-on: ubuntu-latest
env:
IMAGE_URL: ${{ secrets.GITLAB_REGISTRY_IMAGE_URL }}
IMAGE_NAME: cns_flight_stack_cws_env
COMMIT_HASH: ${{ github.sha }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup QEMU
uses: docker/[email protected]
- name: Set up Docker Buildx
id: buildx
uses: docker/[email protected]
- name: Login to Registry
env:
DOCKER_USER: ${{secrets.GITLAB_REGISTRY_USER}}
DOCKER_PASSWORD: ${{secrets.GITLAB_REGISTRY_PASSWORD}}
DOCKER_URL: ${{secrets.GITLAB_REGISTRY_URL}}
run: |
docker login -u ${DOCKER_USER} -p ${DOCKER_PASSWORD} ${DOCKER_URL}
- name: Build Docker Image (latest)
if: ${{ github.ref_name == 'main' }}
run: >
docker buildx build --platform=linux/amd64,linux/arm64,linux/arm/v7 --tag ${IMAGE_URL}/${IMAGE_NAME}:latest --tag ${IMAGE_URL}/${IMAGE_NAME}:${COMMIT_HASH::6} --compress --force-rm --push ./docker/
- name: Build Docker Image (dev)
if: ${{ github.ref_name == 'development' }}
run: >
docker buildx build --platform=linux/amd64,linux/arm64,linux/arm/v7 --tag ${IMAGE_URL}/${IMAGE_NAME}:dev --tag ${IMAGE_URL}/${IMAGE_NAME}:${COMMIT_HASH::6} --compress --squash --force-rm --push ./docker/