Skip to content

Generate tagged Harmonic RoboticsBackend image #4

Generate tagged Harmonic RoboticsBackend image

Generate tagged Harmonic RoboticsBackend image #4

# Generates and uploads an image of Robotics-Backend using the desired tag and branches
name: Generate tagged Harmonic RoboticsBackend image
on:
workflow_dispatch:
inputs:
tag:
description: 'Docker Image Tag'
required: true
default: test
RI:
description: 'Branch of Robotics Infrastructure'
required: true
default: humble-devel
RAM:
description: 'Branch of Robotics Application Manager'
required: true
default: humble-devel
ROS:
description: 'ROS Distro (humble)'
required: true
default: humble
jobs:
push_to_registry:
name: Run Test and Update Docker Image
runs-on: ubuntu-latest
steps:
- name: Check out the repo # checking our the code at current commit that triggers the workflow
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.branch-webserver-id }}
fetch-depth: 1
# - name: Cache dependency # caching dependency will make our build faster.
# uses: actions/cache@v3 # for more info checkout pip section documentation at https://github.com/actions/cache
# with:
# path: ~/.cache/pip
# key: ${{ runner.os }}-pip-${{ hashFiles('**/utils/requirements.txt') }}
# restore-keys: |
# ${{ runner.os }}-pip-
# - name: Setup python environment # setting python environment to 3.8
# uses: actions/setup-python@v3
# with:
# python-version: '3.8'
# - name: Check Python version # checking the python version to see if 3.8 is installed.
# run: python --version
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build base image
run: |
sudo apt-get update
cd scripts
if [ "${{ github.event.inputs.ROS }}" == "humble" ]; then
docker build -f Dockerfile.dependencies_humble_mix_gazebo -t jderobot/robotics-applications:dependencies-humble .
else
echo "Incorrect ROS version"
fi
- name: Build and push RADI
run: |
cd scripts
if [ "${{ github.event.inputs.ROS }}" == "humble" ]; then
docker build --no-cache -f Dockerfile.humble \
--build-arg ROBOTICS_INFRASTRUCTURE=${{ github.event.inputs.RI }} \
--build-arg RAM=${{ github.event.inputs.RAM }} \
--build-arg ROS_DISTRO=${{ github.event.inputs.ROS }} \
--build-arg IMAGE_TAG=${{ github.event.inputs.tag }} \
-t jderobot/robotics-backend:${{ github.event.inputs.tag }} .
docker push jderobot/robotics-backend:${{ github.event.inputs.tag }}
else
echo "Incorrect ROS version"
fi
- name: Upload as Latest
if: ${{ inputs.latest }}
run: |
docker image tag jderobot/robotics-backend:${{ github.event.inputs.tag }} jderobot/robotics-backend:latest
docker push jderobot/robotics-backend:latest
# - name: Build base image
# uses: docker/build-push-action@v2
# with:
# push: true
# tags: localhost:5000/robotics-applications:dependencies-****
# context: business
# file: business/Dockerfile
# - name: Build and push RADI
# uses: docker/build-push-action@v2
# with:
# push: true
# tags: my-ecr-repo/service
# context: service
# file: service/Dockerfile
# build-args: |
# BASE_IMAGE=localhost:5000/my-project/base