-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Github Actions for building images for environments (#282)
Add two workflows, rather one reusable workflow. This reusable workflow builds both local and vnc development image (vnc image is based on the built local image), Trigger this workflow everytime there is a change detected in workflow spec YAMLs, or in the docker dir. Add context to docker README file.
- Loading branch information
Showing
6 changed files
with
148 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Deploy Images to GHCR | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
flavor: | ||
required: false | ||
default: "devel" | ||
type: string | ||
base_image: | ||
required: false | ||
default: "osrf/ros:humble-desktop" | ||
type: string | ||
|
||
jobs: | ||
push-mep3-image: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: "./docker" | ||
|
||
steps: | ||
- name: "Checkout GitHub Action" | ||
uses: actions/checkout@main | ||
|
||
- name: "Login to GitHub Container Registry" | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{github.actor}} | ||
password: ${{secrets.GITHUB_TOKEN}} | ||
|
||
- name: "Configure Docker parameters" | ||
id: configure_docker_params | ||
run: | | ||
#!/bin/bash | ||
case ${{inputs.flavor}} in | ||
"vnc") | ||
echo "dockerfile=Dockerfile.vnc" >> $GITHUB_OUTPUT | ||
echo "image_name=mep3-vnc" >> $GITHUB_OUTPUT | ||
;; | ||
*) | ||
echo "dockerfile=Dockerfile.base" >> $GITHUB_OUTPUT | ||
echo "image_name=mep3" >> $GITHUB_OUTPUT | ||
;; | ||
esac | ||
- uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build and Push Docker Image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: docker | ||
file: ./docker/${{ steps.configure_docker_params.outputs.dockerfile }} | ||
build-args: | | ||
BASE_IMAGE=${{ inputs.base_image }} | ||
push: true | ||
tags: | | ||
ghcr.io/${{ github.repository_owner }}/${{ steps.configure_docker_params.outputs.image_name }}:latest | ||
ghcr.io/${{ github.repository_owner }}/${{ steps.configure_docker_params.outputs.image_name }}:${{ github.sha }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "docker/**" | ||
- ".github/workflows/build_and_push_image_workflow.yml" | ||
- ".github/workflows/build_and_push_images.yml" | ||
jobs: | ||
build-base: | ||
uses: ./.github/workflows/build_and_push_image_workflow.yml | ||
notify: | ||
needs: build-base | ||
name: build-vnc | ||
uses: ./.github/workflows/build_and_push_image_workflow.yml | ||
with: | ||
flavor: vnc | ||
base_image: "ghcr.io/${{ github.repository }}:${{ github.sha }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters