From 6834c7b2858746390ff2621daf66b19884d10af5 Mon Sep 17 00:00:00 2001 From: Tomas Baca Date: Wed, 3 Jul 2024 16:28:38 +0200 Subject: [PATCH] added docker workflow --- .ci/build_docker.sh | 21 +++++++++++++++++++++ .ci/build_docker_multiarch.sh | 1 + .github/workflows/docker.yml | 24 ++++++++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100755 .ci/build_docker.sh create mode 100755 .ci/build_docker_multiarch.sh create mode 100644 .github/workflows/docker.yml diff --git a/.ci/build_docker.sh b/.ci/build_docker.sh new file mode 100755 index 0000000000..7feeb607ba --- /dev/null +++ b/.ci/build_docker.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -e + +trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG +trap 'echo "$0: \"${last_command}\" command failed with exit code $?' ERR + +git clone https://github.com/ctu-mrs/mrs_docker +cd mrs_docker/recipes + +docker login --username klaxalk --password $TOKEN + +# docker build . --file docker/without_linux_setup --tag ctumrs/mrs_uav_system:latest + +docker buildx create --name container --driver=docker-container +docker buildx build --push . --file Dockerfile --builder container --tag ctumrs/mrs_uav_system:latest --platform=linux/amd64,linux/arm64 + +WEEK_TAG="`date +%Y`_w`date +%V`" +docker tag ctumrs/mrs_uav_system:latest ctumrs/mrs_uav_system:$WEEK_TAG + +docker buildx imagetools create -t ctumrs/mrs_uav_system:latest ctumrs/mrs_uav_system:$WEEK_TAG --push diff --git a/.ci/build_docker_multiarch.sh b/.ci/build_docker_multiarch.sh new file mode 100755 index 0000000000..a9bf588e2f --- /dev/null +++ b/.ci/build_docker_multiarch.sh @@ -0,0 +1 @@ +#!/bin/bash diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000000..5eb77e2226 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,24 @@ +name: docker + +on: + + workflow_dispatch: + + schedule: + - cron: '0 10 * * *' + +jobs: + + generate-jobs: + needs: init-artifacts + runs-on: ubuntu-20.04 + env: + TOKEN: ${{ secrets.DOCKERHUB }} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + submodules: 'recursive' + - id: build + run: | + ./.ci/build_docker.sh