-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi-arch build #42
Merged
Merged
Multi-arch build #42
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -1,56 +1,59 @@ | ||
name: tii-mocap-pose | ||
|
||
on: | ||
push: | ||
paths-ignore: | ||
- 'README.md' | ||
- 'CHANGELOG.rst' | ||
pull_request: | ||
repository_dispatch: | ||
types: [fog-ros-baseimage-update] | ||
push: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
name: Build & push | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Set image tag format without suffix | ||
run: | | ||
echo "IMAGE_TAG_FORMAT=type=sha" >> $GITHUB_ENV | ||
if: github.event_name == 'push' | ||
- name: Setup QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
with: | ||
platforms: amd64,riscv64,arm64 | ||
|
||
- name: Set image tag format with suffix | ||
# it is possible that run_number should be used instead run_attempt | ||
# run_attempt is unique number on every run and run_attempt resets to 1 if re-build is not used | ||
# content of image_sha_tag_suffix is defined in fog-ros-baseimage dispatcher workflow. | ||
run: | | ||
echo "IMAGE_TAG_FORMAT=type=sha,suffix=-${{ github.event.client_payload.image_sha_tag_suffix }}" >> $GITHUB_ENV | ||
if: github.event_name == 'repository_dispatch' | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ghcr.io/tiiuae/tii-mocap-pose | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=raw,value=latest | ||
${{ env.IMAGE_TAG_FORMAT }} | ||
type=sha | ||
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }} | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build container image and push | ||
uses: docker/build-push-action@v4 | ||
- name: Build image and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/riscv64,linux/arm64 | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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 |
---|---|---|
@@ -1,26 +1,28 @@ | ||
FROM ghcr.io/tiiuae/fog-ros-baseimage-builder:v2.1.0 AS builder | ||
# Given dynamically from CI job. | ||
FROM --platform=${BUILDPLATFORM:-linux/amd64} ghcr.io/tiiuae/fog-ros-sdk:v3.0.1-${TARGETARCH:-amd64} AS builder | ||
|
||
COPY . /main_ws/src/ | ||
# Must be defined another time after "FROM" keyword. | ||
ARG TARGETARCH | ||
|
||
# this: | ||
# 1) builds the application | ||
# 2) packages the application as .deb in /main_ws/ | ||
# SRC_DIR environment variable is defined in the fog-ros-sdk image. | ||
# The same workspace path is used by all ROS2 components. | ||
# See: https://github.com/tiiuae/fog-ros-baseimage/blob/main/Dockerfile.sdk_builder | ||
COPY . $SRC_DIR/mocap_pose | ||
|
||
RUN /packaging/build.sh | ||
# Tar directories so they are easier to handle when doing installation. | ||
RUN /packaging/build_colcon_sdk.sh ${TARGETARCH:-amd64} | ||
# Even though it is possible to tar the install directory for retrieving it later in runtime image, | ||
# the tar extraction in arm64 emulated on arm64 is still slow. So, we copy the install directory instead | ||
|
||
# ▲ runtime ──┐ | ||
# └── build ▼ | ||
|
||
FROM ghcr.io/tiiuae/fog-ros-baseimage:v2.1.0 | ||
|
||
HEALTHCHECK --interval=5s \ | ||
CMD fog-health check --metric=location_update_count --diff-gte=5.0 \ | ||
--metrics-from=http://localhost:${METRICS_PORT}/metrics --only-if-nonempty=${METRICS_PORT} | ||
FROM ghcr.io/tiiuae/fog-ros-baseimage:v3.0.1 | ||
|
||
ENTRYPOINT [ "/entrypoint.sh" ] | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
COPY --from=builder /main_ws/ros-*-mocap-pose_*_amd64.deb /mocap-pose.deb | ||
# WORKSPACE_DIR environment variable is defined in the fog-ros-baseimage. | ||
# The same installation directory is used by all ROS2 components. | ||
# See: https://github.com/tiiuae/fog-ros-baseimage/blob/main/Dockerfile | ||
WORKDIR $WORKSPACE_DIR | ||
|
||
RUN dpkg -i /mocap-pose.deb && rm /mocap-pose.deb | ||
COPY --from=builder $WORKSPACE_DIR/install install |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Health checks were removed with this commit.
I noticed from Marita's shared logs:
http://100.117.239.56/logs/2023-10-23_10_46-back-12m0s-ghaf/health.txt
I guess this is an accidental regression and not on purpose.