From cdd61e3512cb6127a918cf1cb92b2041b2845956 Mon Sep 17 00:00:00 2001 From: Benjamin Moosherr Date: Fri, 14 Jun 2024 13:18:33 +0200 Subject: [PATCH 1/2] Fix Windows line endings in the Docker container --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f3a6ccb..7e6702b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,7 +24,7 @@ ENV DEBIAN_FRONTEND=noninteractive # Update the package list and upgrade the system without any prompts RUN apt-get update && apt-get upgrade -y -RUN apt-get install bash git python3 unzip curl -y +RUN apt-get install bash git python3 unzip curl dos2unix -y # Install Python and pip @@ -48,6 +48,9 @@ RUN mkdir data COPY data ./data COPY setup.sh ./setup.sh +# Patch Windows line endings if the repository was cloned on Windows. +RUN find . -exec dos2unix {} + + # Copy all relevant files from the previous stage COPY --from=0 /home/user/target* ./ From 9a9dcfeba4b46d5ba7c1fc9cfa6450272e08519b Mon Sep 17 00:00:00 2001 From: Benjamin Moosherr Date: Fri, 14 Jun 2024 13:18:56 +0200 Subject: [PATCH 2/2] Use `/usr/bin/env` for shebangs On NixOS, `/usr/bash` doesn't exists. Only `/usr/bin/env` is guaranteed to exists. The consensus among Linux distributions is, that one shouldn't rely on `/usr/bash` or `/usr/bin/bash` only `/usr/bin/env`. --- build-on-mac.sh | 3 ++- build.sh | 3 ++- clean.sh | 3 ++- execute.sh | 3 ++- setup.sh | 2 +- stop-execution.sh | 3 ++- 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/build-on-mac.sh b/build-on-mac.sh index 1d5ffbf..261d20f 100755 --- a/build-on-mac.sh +++ b/build-on-mac.sh @@ -1,4 +1,5 @@ -#! /bin/bash +#!/usr/bin/env bash + USER_ID=$(id -u ${SUDO_USER:-$(whoami)}) GROUP_ID=$(id -g ${SUDO_USER:-$(whoami)}) PLATFORM=linux/arm64/v8 diff --git a/build.sh b/build.sh index dd98c35..d30f9b0 100755 --- a/build.sh +++ b/build.sh @@ -1,4 +1,5 @@ -#! /bin/bash +#!/usr/bin/env bash + USER_ID=$(id -u ${SUDO_USER:-$(whoami)}) GROUP_ID=$(id -g ${SUDO_USER:-$(whoami)}) diff --git a/clean.sh b/clean.sh index a79b185..0c2e957 100755 --- a/clean.sh +++ b/clean.sh @@ -1,4 +1,5 @@ -#! /bin/bash +#!/usr/bin/env bash + echo "Cleaning all related Docker data. This may take a moment..." echo "Trying to stop running containers..." docker stop "$(docker ps -a -q --filter "ancestor=boosting")" diff --git a/execute.sh b/execute.sh index 2588146..e3f5511 100755 --- a/execute.sh +++ b/execute.sh @@ -1,4 +1,5 @@ -#! /bin/bash +#!/usr/bin/env bash + echo "Starting $1" docker run --rm -v "$(pwd)/results":"/home/user/results" boosting "$@" diff --git a/setup.sh b/setup.sh index d6713a8..58444d6 100755 --- a/setup.sh +++ b/setup.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Download the ground-truth.zip file curl -o data/ground-truth.zip https://zenodo.org/records/11472597/files/ground-truth.zip?download=1 diff --git a/stop-execution.sh b/stop-execution.sh index 52359cb..c372d34 100755 --- a/stop-execution.sh +++ b/stop-execution.sh @@ -1,4 +1,5 @@ -#! /bin/bash +#!/usr/bin/env bash + echo "Stopping Docker container. This will take a moment..." docker stop "$(docker ps -a -q --filter "ancestor=boosting")" echo "...done."