diff --git a/Taskfile.yml b/Taskfile.yml index d776c1b..bb9d45d 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -18,15 +18,12 @@ tasks: - "go build -o out/{{OS}}/ ." preconditions: - sh: "which go" - msg: Go is not installed. Install Go or build with Docker using the "docker" task build:docker: aliases: - docker cmds: - - cmd: "/c/Program\ Files/Docker/Docker/DockerCli.exe -SwitchLinuxEngine" - platforms: - - windows + - task: build:docker:dockercli - "docker build -t listen-build -f docker/build.Dockerfile --build-arg GOOS='{{OS}}' ." - "mkdir -p out/{{OS}}" - "docker create --name listen-build-tmp listen-build" @@ -39,5 +36,13 @@ tasks: - linux - "docker rm listen-build-tmp" preconditions: - - "which docker" - - "uname | grep -qe Linux -e MINGW" \ No newline at end of file + - sh: "uname | grep -qe Linux -e MINGW -e Darwin" + msg: "This task cannot be ran on OS: {{OS}}" + - sh: "which docker" + msg: Docker is not installed. Install Docker or build with Go using the "build" task + + build:docker:dockercli: + cmds: + - cmd: '"C:\Program Files\Docker\Docker\DockerCli.exe" -SwitchLinuxEngine' + platforms: + - windows diff --git a/docker/build.Dockerfile b/docker/build.Dockerfile index 7fc8372..4e23b68 100644 --- a/docker/build.Dockerfile +++ b/docker/build.Dockerfile @@ -9,8 +9,7 @@ WORKDIR /usr/src/listen COPY . . RUN apk upgrade --no-cache -RUN go install github.com/go-task/task/v3/cmd/task@latest ENV GOOS="linux" -RUN task build +RUN go build -o out/$GOOS/ . CMD ["tail", "-f", "/dev/null"]