Skip to content

Commit

Permalink
Split dockerfiles up
Browse files Browse the repository at this point in the history
  • Loading branch information
HeroCC committed Oct 4, 2024
1 parent d6659f5 commit 0ab0738
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 15 deletions.
79 changes: 64 additions & 15 deletions .github/workflows/docker-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,15 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max

build:
build-minrobot:
runs-on: ubuntu-latest
needs:
- build-base
strategy:
fail-fast: false
matrix:
flavor:
- minrobot
- gui
env:
FLAVOR: ""
steps:
- name: Prepare
run: |
platform=${{ matrix.arch }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
echo "COMMIT_TIMESTAMP=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
- name: Set up QEMU
Expand All @@ -75,13 +69,13 @@ jobs:
images: ${{ env.REGISTRY_IMAGE }}
tags: |
# branch event
type=ref,enable=true,prefix=${{ matrix.flavor }}-,event=branch
type=ref,enable=true,prefix=${{ env.flavor }},event=branch
# tag event
type=ref,enable=true,prefix=${{ matrix.flavor }}-,event=tag
type=ref,enable=true,prefix=${{ env.flavor }},event=tag
# pull request event
type=ref,enable=true,prefix=${{ matrix.flavor }}-pr-,suffix=,event=pr
type=ref,enable=true,prefix=${{ env.flavor }}pr-,suffix=,event=pr
# commit sha
type=sha,prefix=${{ matrix.flavor }}-,suffix=,format=short
type=sha,prefix=${{ env.flavor }},suffix=,format=short
- name: Login to Docker Hub
uses: docker/login-action@v3
Expand All @@ -98,7 +92,62 @@ jobs:
with:
platforms: linux/amd64,linux/arm64
annotations: ${{ steps.meta.outputs.annotations }}
file: docker/Dockerfile
target: ${{ matrix.flavor }}
file: docker/moos-ivp/Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.meta.outputs.tags }}

build-gui:
runs-on: ubuntu-latest
needs:
- build-minrobot
env:
FLAVOR: "-gui"
steps:
- name: Prepare
run: |
echo "COMMIT_TIMESTAMP=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
env:
SOURCE_DATE_EPOCH: ${{ env.COMMIT_TIMESTAMP }}
with:
images: ${{ env.REGISTRY_IMAGE }}
tags: |
# branch event
type=ref,enable=true,suffix=${{ env.FLAVOR }},event=branch
# tag event
type=ref,enable=true,suffix=${{ env.FLAVOR }},event=tag
# pull request event
type=ref,enable=true,suffix=pr-,suffix=${{ env.FLAVOR }},event=pr
# commit sha
type=sha,prefix=${{ env.FLAVOR }},suffix=,format=short
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push by digest
id: build
uses: docker/build-push-action@v6
env:
SOURCE_DATE_EPOCH: ${{ env.COMMIT_TIMESTAMP }}
with:
platforms: linux/amd64,linux/arm64
annotations: ${{ steps.meta.outputs.annotations }}
build-args: |
FROM=${{ needs.build-minrobot.build.outputs.digest }}
file: docker/moos-ivp-gui/Dockerfile
cache-from: type=gha
tags: ${{ steps.meta.outputs.tags }}
13 changes: 13 additions & 0 deletions docker/moos-ivp-gui/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
ARG FROM=moosivp/moos-ivp:trunk
FROM $FROM

LABEL maintainer="Conlan Cesar <[email protected]>""
# Install required MOOS dependencies
USER root
RUN apt-get update -y && apt-get install -y cmake build-essential subversion git libtiff5-dev libfltk1.3-dev freeglut3-dev libpng-dev libjpeg-dev libxinerama-dev libxft-dev && apt-get clean
USER moos
# Build the MOOS-IvP tools
RUN cd "$HOME/moos-ivp" && ./build-moos.sh --release && ./build-ivp.sh
File renamed without changes.

0 comments on commit 0ab0738

Please sign in to comment.