From 2a15efed022fe8d7d374a4d8aa273224e84e283e Mon Sep 17 00:00:00 2001 From: ad-daniel Date: Wed, 27 Apr 2022 11:26:57 +0200 Subject: [PATCH 1/3] Fix --- .github/workflows/tests_suite.yml | 6 ++++++ Dockerfile | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests_suite.yml b/.github/workflows/tests_suite.yml index b37e8bd9fd..bbe1f4009b 100644 --- a/.github/workflows/tests_suite.yml +++ b/.github/workflows/tests_suite.yml @@ -139,8 +139,14 @@ jobs: - uses: actions/checkout@v2 with: submodules: true + - name: Get branch name + id: branch-name + uses: tj-actions/branch-names@v5.1 - name: Build image run: | + cat Dockerfile + sed -i 's/# %branch-name-template%/-b ${{ steps.branch-name.outputs.current_branch }}/' Dockerfile + cat Dockerfile docker build --tag opendr/opendr-toolkit:cpu_test --file Dockerfile . docker save opendr/opendr-toolkit:cpu_test > cpu_test.zip - name: Upload image artifact diff --git a/Dockerfile b/Dockerfile index 8ee99caa7b..52189b930d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ RUN chmod +x /tini ENTRYPOINT ["/tini", "--"] # Clone the repo and install the toolkit -RUN git clone --depth 1 --recurse-submodules -j8 https://github.com/opendr-eu/opendr +RUN git clone --depth 1 --recurse-submodules -j8 https://github.com/opendr-eu/opendr # %branch-name-template% WORKDIR "/opendr" RUN ./bin/install.sh From 362a0df34fb125cdfbcbaa3b67ee8652f78a0f16 Mon Sep 17 00:00:00 2001 From: ad-daniel Date: Wed, 27 Apr 2022 11:54:51 +0200 Subject: [PATCH 2/3] Better approach --- .github/workflows/publisher.yml | 10 ++++++++-- .github/workflows/tests_suite.yml | 5 +---- .github/workflows/tests_suite_develop.yml | 5 ++++- Dockerfile | 4 +++- Dockerfile-cuda | 4 +++- 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.github/workflows/publisher.yml b/.github/workflows/publisher.yml index 6dc43014d2..0f30b75b7d 100644 --- a/.github/workflows/publisher.yml +++ b/.github/workflows/publisher.yml @@ -42,8 +42,11 @@ jobs: - uses: actions/checkout@v2 with: submodules: true + - name: Get branch name + id: branch-name + uses: tj-actions/branch-names@v5.1 - name: Build Docker Image - run: docker build --tag opendr-toolkit:cpu_$OPENDR_VERSION --file Dockerfile . + run: docker build --tag opendr-toolkit:cpu_$OPENDR_VERSION --build-arg branch=${{ steps.branch-name.outputs.current_branch }} --file Dockerfile . - name: Login to Docker Hub uses: docker/login-action@v1 with: @@ -59,8 +62,11 @@ jobs: - uses: actions/checkout@v2 with: submodules: true + - name: Get branch name + id: branch-name + uses: tj-actions/branch-names@v5.1 - name: Build Docker Image - run: docker build --tag opendr-toolkit:cuda_$OPENDR_VERSION --file Dockerfile-cuda . + run: docker build --tag opendr-toolkit:cuda_$OPENDR_VERSION --build-arg branch=${{ steps.branch-name.outputs.current_branch }} --file Dockerfile-cuda . - name: Login to Docker Hub uses: docker/login-action@v1 with: diff --git a/.github/workflows/tests_suite.yml b/.github/workflows/tests_suite.yml index bbe1f4009b..eb0b44d3fb 100644 --- a/.github/workflows/tests_suite.yml +++ b/.github/workflows/tests_suite.yml @@ -144,10 +144,7 @@ jobs: uses: tj-actions/branch-names@v5.1 - name: Build image run: | - cat Dockerfile - sed -i 's/# %branch-name-template%/-b ${{ steps.branch-name.outputs.current_branch }}/' Dockerfile - cat Dockerfile - docker build --tag opendr/opendr-toolkit:cpu_test --file Dockerfile . + docker build --tag opendr/opendr-toolkit:cpu_test --build-arg branch=${{ steps.branch-name.outputs.current_branch }} --file Dockerfile . docker save opendr/opendr-toolkit:cpu_test > cpu_test.zip - name: Upload image artifact uses: actions/upload-artifact@v2 diff --git a/.github/workflows/tests_suite_develop.yml b/.github/workflows/tests_suite_develop.yml index b9d9825f2c..c209cd8141 100644 --- a/.github/workflows/tests_suite_develop.yml +++ b/.github/workflows/tests_suite_develop.yml @@ -143,9 +143,12 @@ jobs: with: submodules: true ref: develop + - name: Get branch name + id: branch-name + uses: tj-actions/branch-names@v5.1 - name: Build image run: | - docker build --tag opendr/opendr-toolkit:cpu_test --file Dockerfile . + docker build --tag opendr/opendr-toolkit:cpu_test --build-arg branch=${{ steps.branch-name.outputs.current_branch }} --file Dockerfile . docker save opendr/opendr-toolkit:cpu_test > cpu_test.zip - name: Upload image artifact uses: actions/upload-artifact@v2 diff --git a/Dockerfile b/Dockerfile index 52189b930d..13779df3ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ FROM ubuntu:20.04 +ARG BRANCH + # Install dependencies RUN apt-get update && \ apt-get --yes install git sudo @@ -12,7 +14,7 @@ RUN chmod +x /tini ENTRYPOINT ["/tini", "--"] # Clone the repo and install the toolkit -RUN git clone --depth 1 --recurse-submodules -j8 https://github.com/opendr-eu/opendr # %branch-name-template% +RUN git clone --depth 1 --recurse-submodules -j8 https://github.com/opendr-eu/opendr -b $branch WORKDIR "/opendr" RUN ./bin/install.sh diff --git a/Dockerfile-cuda b/Dockerfile-cuda index 6c70f3853a..d44b8b3cb7 100644 --- a/Dockerfile-cuda +++ b/Dockerfile-cuda @@ -1,5 +1,7 @@ FROM nvidia/cuda:11.0-base +ARG branch + # Install dependencies RUN apt-get update && \ apt-get --yes install git sudo apt-utils @@ -43,7 +45,7 @@ RUN sudo apt-get --yes install build-essential && \ # Clone the repo and install the toolkit ENV OPENDR_DEVICE gpu -RUN git clone --depth 1 --recurse-submodules -j8 https://github.com/opendr-eu/opendr +RUN git clone --depth 1 --recurse-submodules -j8 https://github.com/opendr-eu/opendr -b $branch WORKDIR "/opendr" RUN ./bin/install.sh From 52c14919a2bfc684fc3b6f29ace353c58ab56140 Mon Sep 17 00:00:00 2001 From: ad-daniel Date: Wed, 27 Apr 2022 11:55:51 +0200 Subject: [PATCH 3/3] Fix --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 13779df3ff..82c44286f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM ubuntu:20.04 -ARG BRANCH +ARG branch # Install dependencies RUN apt-get update && \