Skip to content

Building production images #2

Building production images

Building production images #2

name: Building production images (we are still testing these, so use at your own risk)
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:
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
with:
driver: docker # Default is docker-container
# 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
# Call docker compose build with UID explicit
- name: Call docker compose build with UID explicit
run: |
shopt -s expand_aliases
source scripts/build_images.sh -c docker-compose-prod.yml
echo "Built base images, return 0 if good, 1 if failure: $?"
# Push cfs image
# (not using build-and-push action as passing images is giving me trouble)
- name: Push cfs
run: |
local_tag="cfs"
remote_tag="${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${local_tag}"
docker tag $local_tag $remote_tag
docker push $remote_tag
# Push rosgsw image
# (not using build-and-push action as passing images is giving me trouble)
- name: Push rosgsw
run: |
local_tag="rosgsw"
remote_tag="${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${local_tag}"
docker tag $local_tag $remote_tag
docker push $remote_tag
# Push rosfsw image
# (not using build-and-push action as passing images is giving me trouble)
- name: Push rosfsw
run: |
local_tag="rosfsw"
remote_tag="${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${local_tag}"
docker tag $local_tag $remote_tag
docker push $remote_tag