forked from Lichtblick-Suite/lichtblick
-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (58 loc) · 1.99 KB
/
build-docker-image.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Build a Docker Image
on:
push:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set FOXGLOVE_VERSION env
run: echo "FOXGLOVE_VERSION=$(yq .version package.json | tr -d '\"')" >> $GITHUB_ENV
shell: bash
- name: Set SHORT_DATE env
run: echo "SHORT_DATE=$(date +%Y%m%d)" >> $GITHUB_ENV
shell: bash
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
version: latest
- name: Login to Docker Registry
uses: docker/login-action@v2
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push (production)
if: github.ref_name == 'main'
uses: docker/build-push-action@v3
with:
platforms: linux/amd64, linux/arm64
push: true
file: ./husarion_add_ons/Dockerfile
build-args: |
FOXGLOVE_VERSION=${{ env.FOXGLOVE_VERSION }}
tags: |
husarion/foxglove:${{ env.FOXGLOVE_VERSION }}-${{ env.SHORT_DATE }}
husarion/foxglove:${{ env.FOXGLOVE_VERSION }}
husarion/foxglove:nightly
# cache-from: type=registry,ref=husarnet/dds-router
cache-to: type=inline
- name: Build and push (feature branch)
if: github.ref_name != 'main'
uses: docker/build-push-action@v3
with:
# platforms: linux/amd64, linux/arm64
platforms: linux/amd64
push: true
file: ./husarion_add_ons/Dockerfile
build-args: |
FOXGLOVE_VERSION=${{ env.FOXGLOVE_VERSION }}
tags: |
husarion/foxglove:${{ github.head_ref || github.ref_name }}-${{ env.FOXGLOVE_VERSION }}
husarion/foxglove:nightly
# cache-from: type=registry,ref=husarnet/dds-router-${{ github.head_ref || github.ref_name }}
cache-to: type=inline