Create cfs-dev, rosgsw-dev and rosfsw-dev docker images #21
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
name: Create cfs-base and brash-ros-base docker images | |
on: | |
workflow_dispatch: | |
# Push | |
pull_request: | |
branches: | |
- devel | |
env: | |
# Use docker.io for DockerHub if empty | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build_brash_noetic: | |
runs-on: ubuntu-20.04 | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
steps: | |
# Checkout this repository | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Set up docker buildx (latest build magic) | |
- name: Set up docker buildx | |
uses: docker/setup-buildx-action@v3 | |
# Log in to Docker registry | |
- name: Log into registry ${{env.REGISTRY}} | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{env.REGISTRY}} | |
username: ${{github.actor}} | |
password: ${{secrets.GITHUB_TOKEN}} | |
# Extract metadata for docker | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{env.REGISTRY}}/${{env.IMAGE_NAME}} | |
# This repository is checked out! It needs to pull recursively | |
- name: Clone brash_docker and submodules (cFS, brash and juicer) | |
run: | | |
git submodule update --init --recursive | |
# Clone brash workspace repositories | |
- name: Clone brash workspace repositories | |
run: | | |
cd brash | |
pip3 install vcstool | |
mkdir src | |
vcs import src < https.repos | |
# Source setup_dev and call docker-compose build | |
- name: Source setup_dev and call docker-compose build | |
run: | | |
shopt -s expand_aliases | |
docker compose -f docker-compose-dev.yml build | |
# Build cfs_base | |
- name: Build cfs-base | |
run: | | |
shopt -s expand_aliases | |
echo "Print current pwd" | |
pwd | |
echo "Print docker file" | |
docker compose -f docker-compose-dev.yml config | |
echo "User id:" | |
echo "${UID}" | |
source scripts/build_cfe.sh | |
echo "Build fsw, should return 0 if good, 1 if failure: $?" | |
# Build brash-ros-base | |
- name: Build brash-ros-base | |
run: | | |
shopt -s expand_aliases | |
source scripts/build_brash.sh | |
echo "Build rosgsw should return 0 if good, 1 if failure: $?" | |
# Push cfs-base image | |
# (not using build-and-push action as passing images is giving me trouble) | |
- name: Push cfs-base | |
run: | | |
local_tag="cfs-base" | |
remote_tag="${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${local_tag}" | |
docker tag $local_tag $remote_tag | |
docker push $remote_tag | |
# Push brash-ros-base image | |
# (not using build-and-push action as passing images is giving me trouble) | |
- name: Push brash-ros-base | |
run: | | |
local_tag="brash-ros-base" | |
remote_tag="${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${local_tag}" | |
docker tag $local_tag $remote_tag | |
docker push $remote_tag | |