From 16a6ff23376f98053f7b969b4e995c6922ba8d7a Mon Sep 17 00:00:00 2001 From: Fernando Cladera Date: Wed, 24 Jan 2024 23:43:18 -0500 Subject: [PATCH] Github action for Docker build --- .github/workflows/docker-build.yaml | 35 +++++++++++++++++++++++++++++ Dockerfile | 26 +++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 .github/workflows/docker-build.yaml create mode 100644 Dockerfile diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml new file mode 100644 index 0000000..5bba3fe --- /dev/null +++ b/.github/workflows/docker-build.yaml @@ -0,0 +1,35 @@ +name: docker-build-base + +# Only build base when any of the files in the base directory are modified +on: + push: + branches: [master, ci] + tags: + - '*' + workflow_dispatch: + schedule: + - cron: '0 0 * * 0' + +jobs: + main: + runs-on: ubuntu-20.04 + + steps: + - + name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - + name: Build and push + id: docker_build + uses: docker/build-push-action@v5 + with: + context: "{{defaultContext}}" + push: false + platforms: linux/amd64 + build-args: git_hash=${{ github.sha }} + - + name: Image digest + run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b6c4020 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +# Note: this Dockerfile is only used for the CI. Please refer to the +# instructions in README.md to use this repo + +FROM kumarrobotics/jackal-master:latest + +# Requires a docker build argument `user_id` +ARG user_id=1000 +env USER dcist +ARG git_hash + +# Create a base docker environment +RUN . ~/jackal_ws/devel/setup.sh \ + && mkdir -p ~/user_ws/src && cd ~/user_ws \ + && catkin config --extend ~/jackal_ws/devel \ + && catkin build --no-status -DCMAKE_BUILD_TYPE=Release + +# Clone the git directory +RUN cd ~/user_ws/src \ + && git clone --recursive -j4 https://github.com/KumarRobotics/spomp-system.git \ + && cd spomp-system \ + && git checkout ${git_hash} + +# Build the workspace +RUN cd ~/user_ws \ + && catkin build --no-status -DCMAKE_BUILD_TYPE=Release \ + && catkin build