Skip to content

Commit

Permalink
testing new workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikN committed Oct 3, 2023
1 parent ba9533a commit 884fb00
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 56 deletions.
112 changes: 57 additions & 55 deletions .github/workflows/build-docker-image.yaml
Original file line number Diff line number Diff line change
@@ -1,64 +1,66 @@
name: Build/Publish Docker Image
name: Build a Docker Image

on:
on:
push:
workflow_dispatch:
inputs:
build_type:
description: "Is it a \"development\" or a \"stable\" release?"
required: true
default: 'development'
type: choice
options:
- development
- stable
target_distro:
description: "In case of \"stable\" release specify the ROS distro of the existing docker image (eg. humble)"
type: string
default: "ardent"
target_release:
description: "In case of \"stable\" release specify the version of the existing docker image (eg. 1.0.12)"
type: string
default: "0.0.0"
target_date:
description: "In case of \"stable\" release specify the date of the existing docker image in format YYYYMMDD (eg. 20220124)"
type: string
default: "20131206"
repository_dispatch:
types: [rebuild]
pull_request:
types:
- closed
- opened


jobs:
build:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:

include:
- dockerfile: Dockerfile
platforms: "linux/amd64, linux/arm64"
ros_distro: "humble"
repo_name: foxglove

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set FOXGLOVE_VERSION env
run: echo "FOXGLOVE_VERSION=v1.39.1" >> $GITHUB_ENV
shell: bash

- name: Set SHORT_DATE env
run: echo "SHORT_DATE=$(date +%Y%m%d)" >> $GITHUB_ENV
shell: bash

- name: Checkout
uses: actions/checkout@v2
- 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
build-args: |
FOXGLOVE_VERSION=${{ env.FOXGLOVE_VERSION }}
tags: |
husarnet/foxglove:${{ env.FOXGLOVE_VERSION }}-${{ env.SHORT_DATE }}
husarnet/foxglove:${{ env.FOXGLOVE_VERSION }}
husarnet/foxglove:nightly
# cache-from: type=registry,ref=husarnet/dds-router
cache-to: type=inline

- name: Build Docker Image
uses: husarion-ci/[email protected]
with:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
dockerfile: ${{ matrix.dockerfile }}
repo_name: ${{ matrix.repo_name }}
build_type: ${{ inputs.build_type }}
ros_distro: ${{ matrix.ros_distro }}
platforms: ${{ matrix.platforms }}
# variables important only for stable release
target_distro: ${{ inputs.target_distro }}
target_release: ${{ inputs.target_release }}
target_date: ${{ inputs.target_date }}
- 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
build-args: |
FOXGLOVE_VERSION=${{ env.FOXGLOVE_VERSION }}
tags: |
husarnet/foxglove:${{ github.head_ref || github.ref_name }}-${{ env.FOXGLOVE_VERSION }}
husarnet/foxglove:nightly
# cache-from: type=registry,ref=husarnet/dds-router-${{ github.head_ref || github.ref_name }}
cache-to: type=inline
2 changes: 1 addition & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:
foxglove:
build:
dockerfile: Dockerfile.foxglove
dockerfile: Dockerfile
network_mode: host
environment:
- FOXGLOVE_PORT=8080
Expand Down

0 comments on commit 884fb00

Please sign in to comment.