Skip to content

Commit

Permalink
Bake arm64 image with mimic-cross
Browse files Browse the repository at this point in the history
  • Loading branch information
f0reachARR committed Feb 22, 2024
1 parent 9365342 commit f18daa7
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 26 deletions.
28 changes: 6 additions & 22 deletions .github/workflows/Docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ on:
- cron: 0 0 * * *
pull_request:
paths:
- '**'
- '!docs/**'
- '!README.md'
- '!.github/**'
- '.github/workflows/Docker.yaml'
- '!mkdocs.yml'
- "**"
- "!docs/**"
- "!README.md"
- "!.github/**"
- ".github/workflows/Docker.yaml"
- "!mkdocs.yml"
push:
branches:
- master
Expand Down Expand Up @@ -62,19 +62,3 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
targets: |
${{ matrix.rosdistro }}
set: |
*.platform=linux/amd64
- name: Build and push (arm64)
uses: docker/bake-action@v3
if: ${{ matrix.runs_on == 'macos-14'}}
with:
files: |
./docker-bake.hcl
workdir: .
no-cache: true
push: ${{ github.event_name != 'pull_request' }}
targets: |
${{ matrix.rosdistro }}
set: |
*.platform=linux/arm64/v8
43 changes: 43 additions & 0 deletions Dockerfile.arm64
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
ARG ROS_DISTRO="humble"

FROM --platform=${BUILDPLATFORM} impactaky/mc-ubuntu22.04-${TARGETARCH}-host:2.0.1 AS mimic-host

Check warning on line 3 in Dockerfile.arm64

View workflow job for this annotation

GitHub Actions / spell-check

Unknown word (BUILDPLATFORM)

Check warning on line 3 in Dockerfile.arm64

View workflow job for this annotation

GitHub Actions / spell-check

Unknown word (impactaky)

Check warning on line 3 in Dockerfile.arm64

View workflow job for this annotation

GitHub Actions / spell-check

Unknown word (TARGETARCH)
FROM ros:${ROS_DISTRO} as build-stage

SHELL ["/bin/bash", "-c"]
ENV DEBIAN_FRONTEND=noninteractive
ENV DEBCONF_NOWARNINGS=yes

COPY --from=mimic-host / /mimic-cross
RUN /mimic-cross/mimic-cross.deno/setup.sh

Check warning on line 11 in Dockerfile.arm64

View workflow job for this annotation

GitHub Actions / spell-check

Unknown word (deno)

RUN sudo apt-get update && sudo apt-get -y install python3-pip python3-rospkg python3-rosdep software-properties-common ccache
# cspell: ignore kisak
RUN add-apt-repository ppa:kisak/kisak-mesa -y
RUN apt-get update && apt-get install libegl-mesa0 -y

WORKDIR /home/ubuntu/Desktop/scenario_simulator_ws/src/scenario_simulator
COPY . $WORKDIR

WORKDIR /home/ubuntu/Desktop/scenario_simulator_ws/
RUN mkdir -p /home/ubuntu/Desktop/scenario_simulator_ws/src/scenario_simulator/external
WORKDIR /home/ubuntu/Desktop/scenario_simulator_ws/src/scenario_simulator
RUN vcs import external < dependency_${ROS_DISTRO}.repos
WORKDIR /home/ubuntu/Desktop/scenario_simulator_ws/src
RUN source /opt/ros/${ROS_DISTRO}/setup.bash && rosdep install -iy --from-paths . --rosdistro ${ROS_DISTRO}

WORKDIR /home/ubuntu/Desktop/scenario_simulator_ws

ENV CC="/usr/lib/ccache/gcc"
ENV CXX="/usr/lib/ccache/g++"
ENV CCACHE_DIR="/ccache"
RUN --mount=type=cache,target=/ccache source /opt/ros/${ROS_DISTRO}/setup.bash && \
colcon build --symlink-install \
--cmake-args \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DBUILD_CPP_MOCK_SCENARIOS=ON
COPY ./docker-entrypoint.sh /
RUN chmod a+x /docker-entrypoint.sh

ENTRYPOINT ["/docker-entrypoint.sh"]
15 changes: 11 additions & 4 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,21 @@ group "default" {
target "base" {
target = "build-stage"
dockerfile = "Dockerfile"
platforms = ["linux/amd64", "linux/arm64/v8"]
platforms = ["linux/amd64"]
}

target "base_arm64" {
dockerfile = "Dockerfile.arm64"
platforms = ["linux/arm64/v8"]
}

target "humble" {
inherits = ["base"]
name = "humble"
inherits = [base]
name = "humble-${base}"
tags = ["ghcr.io/tier4/scenario_simulator_v2:humble"]
args = {"ROS_DISTRO" : "humble"}
group = ["humble"]
matrix = {}
matrix = {
base = ["base", "base_arm64"]
}
}

0 comments on commit f18daa7

Please sign in to comment.