Skip to content

Commit

Permalink
Github action for Docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
fcladera committed Jan 25, 2024
1 parent 931a6f0 commit 8ca9c45
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
-
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 }}
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Note: this Dockerfile is only used for the CI. Please refer to the
# instructions in README.md to use this repo

FROM kumarrobotics/dcist-master:latest

# Requires a docker build argument `user_id`
ARG user_id=1000
env USER dcist

# Create a base docker environment
RUN . /home/$USER/dcist_ws/devel/setup.sh \
&& mkdir -p /home/$USER/user_ws/src && cd /home/$USER/user_ws \
&& catkin config --extend ~/dcist_ws/devel \
&& catkin build --no-status -DCMAKE_BUILD_TYPE=Release

# Copy the spomp environment into the user workspace
COPY --chown=$USER:$USER . /home/$USER/user_ws/src/spomp-system

# Build the workspace
RUN cd /home/$USER/user_ws \
&& catkin build --no-status -DCMAKE_BUILD_TYPE=Release \
&& catkin build

0 comments on commit 8ca9c45

Please sign in to comment.