From 100f7190f3e82812fc9ef5ed191ef96d0881df91 Mon Sep 17 00:00:00 2001 From: Juan Font Alonso Date: Sun, 31 Jul 2022 10:44:09 +0200 Subject: [PATCH] Temporary fix integration tests with dedicated Dockerfile --- Dockerfile.tmp-integration | 21 +++++++++++++++++++++ integration_cli_test.go | 2 +- integration_embedded_derp_test.go | 2 +- integration_test.go | 2 +- 4 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 Dockerfile.tmp-integration diff --git a/Dockerfile.tmp-integration b/Dockerfile.tmp-integration new file mode 100644 index 00000000..043be25f --- /dev/null +++ b/Dockerfile.tmp-integration @@ -0,0 +1,21 @@ +# Builder image +FROM docker.io/golang:1.18.0-bullseye AS build +ARG VERSION=dev +ENV GOPATH /go +WORKDIR /go/src/headscale + +COPY go.mod go.sum /go/src/headscale/ +RUN go mod download + +COPY . . +RUN CGO_ENABLED=0 go build -o /go/bin/headscale -ldflags="-s -w -X github.com/juanfont/headscale/cmd/headscale/cli.Version=$VERSION" -a ./cmd/headscale +RUN test -e /go/bin/headscale + +# Production image +FROM gcr.io/distroless/base-debian11 + +COPY --from=build /go/bin/headscale /bin/headscale +ENV TZ UTC + +EXPOSE 8080/tcp +CMD ["headscale"] diff --git a/integration_cli_test.go b/integration_cli_test.go index 2f58e71d..a218abbd 100644 --- a/integration_cli_test.go +++ b/integration_cli_test.go @@ -50,7 +50,7 @@ func (s *IntegrationCLITestSuite) SetupTest() { } headscaleBuildOptions := &dockertest.BuildOptions{ - Dockerfile: "Dockerfile", + Dockerfile: "Dockerfile.tmp-integration", ContextDir: ".", } diff --git a/integration_embedded_derp_test.go b/integration_embedded_derp_test.go index ecca8ba5..465ece29 100644 --- a/integration_embedded_derp_test.go +++ b/integration_embedded_derp_test.go @@ -104,7 +104,7 @@ func (s *IntegrationDERPTestSuite) SetupSuite() { } headscaleBuildOptions := &dockertest.BuildOptions{ - Dockerfile: "Dockerfile", + Dockerfile: "Dockerfile.tmp-integration", ContextDir: ".", } diff --git a/integration_test.go b/integration_test.go index 2214b893..5a73242a 100644 --- a/integration_test.go +++ b/integration_test.go @@ -228,7 +228,7 @@ func (s *IntegrationTestSuite) SetupSuite() { } headscaleBuildOptions := &dockertest.BuildOptions{ - Dockerfile: "Dockerfile", + Dockerfile: "Dockerfile.tmp-integration", ContextDir: ".", }