diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index 4647099..9142af9 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -5,18 +5,39 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - with: # added this, might fix a bug that's taken over 3 hours to find + with: submodules: recursive - - name: build + - name: Set up Docker + uses: docker/setup-docker-action@v4 + with: + daemon-config: | + { + "debug": true, + "features": { + "containerd-snapshotter": true + } + } + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + with: + driver: docker-container + install: true + + - name: Build multi-arch image run: | - docker compose build --no-cache - - name: start and exec into container - run: | # ensure a clean build tree inside container, then build - docker compose run --rm -T rover bash -lc 'rm -rf build install log && colcon build --symlink-install --packages-up-to arm_control' + docker buildx build \ + --platform linux/amd64,linux/arm64 \ + --tag roverflake2:dev \ + --file Dockerfile \ + --push \ + --load . + - name: Start and exec into container + run: | + docker compose run --rm -T rover bash -lc \ + 'rm -rf build install log && colcon build --symlink-install --packages-up-to arm_control' - name: Cleanup if: always() - run: | - docker compose down --remove-orphans || true + run: docker compose down --remove-orphans || true - name: Notify Discord (success) if: ${{ success() }} uses: appleboy/discord-action@v1.0.0 diff --git a/Dockerfile b/Dockerfile index 9fe47d6..aaef99d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,13 @@ # if you have anymore questions ask Aaron # official base image in docs -FROM osrf/ros:humble-desktop +FROM --platform=$TARGETPLATFORM osrf/ros:humble-desktop + +ARG TARGETPLATFORM +ARG BUILDPLATFORM + +# Debugging info (optional) +RUN echo "Building for $TARGETPLATFORM on $BUILDPLATFORM" # consistency with setup files ENV DEBIAN_FRONTEND=noninteractive diff --git a/docker-compose.yml b/docker-compose.yml index f3029ff..53460b4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,6 +17,9 @@ services: build: context: . dockerfile: Dockerfile + #platforms: + #- linux/amd64 + #- linux/arm64 image: roverflake2:dev container_name: rover_dev working_dir: /RoverFlake2