From 91b4d6b6ed59d654f5d3a9aff1f97b07a58b7519 Mon Sep 17 00:00:00 2001 From: Luca Steeb Date: Wed, 10 Jun 2020 16:08:07 +0700 Subject: [PATCH] feat(platforms): add alpine support --- .dockerignore | 2 +- binaries/platform/platform.go | 15 ++++++++++++--- docker/integration.dockerfile | 1 - 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.dockerignore b/.dockerignore index 3a105c19..1f92bcc3 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,6 @@ .git/ .github/ +.idea/ prisma-client-go *.db *.sqlite @@ -8,6 +9,5 @@ prisma-client-go schema.graphql **migrations**/ **/prisma-* -**/query-engine-* build/ .graphqlconfig diff --git a/binaries/platform/platform.go b/binaries/platform/platform.go index 95544530..10681cbc 100644 --- a/binaries/platform/platform.go +++ b/binaries/platform/platform.go @@ -25,6 +25,11 @@ func BinaryPlatformName() string { } distro := getLinuxDistro() + + if distro == "alpine" { + return "linux-musl" + } + ssl := getOpenSSL() name := fmt.Sprintf("%s-openssl-%s", distro, ssl) @@ -59,11 +64,11 @@ func checkForExtension(platform string, path string) string { func getLinuxDistro() string { out, _ := exec.Command("cat", "/etc/os-release").CombinedOutput() - if out == nil { - return "debian" + if out != nil { + return parseLinuxDistro(string(out)) } - return parseLinuxDistro(string(out)) + return "debian" } func parseLinuxDistro(str string) string { @@ -82,6 +87,10 @@ func parseLinuxDistro(str string) string { idLike = idLikeMatches[1] } + if id == "alpine" { + return "alpine" + } + if strings.Contains(idLike, "centos") || strings.Contains(idLike, "fedora") || strings.Contains(idLike, "rhel") || diff --git a/docker/integration.dockerfile b/docker/integration.dockerfile index c35d8c82..8a40245e 100644 --- a/docker/integration.dockerfile +++ b/docker/integration.dockerfile @@ -24,7 +24,6 @@ RUN cd test/integration/; go build -o /app/main . # start a new stage to test if the runtime fetching works FROM golang:1.13 -# TODO try scratch image. golang is used because it's available on both linux and windows WORKDIR /app