Skip to content

Commit

Permalink
feat(platforms): add alpine support (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
steebchen committed Jun 10, 2020
1 parent 5f4eb61 commit 790aa34
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.git/
.github/
.idea/
prisma-client-go
*.db
*.sqlite
Expand All @@ -8,6 +9,5 @@ prisma-client-go
schema.graphql
**migrations**/
**/prisma-*
**/query-engine-*
build/
.graphqlconfig
15 changes: 12 additions & 3 deletions binaries/platform/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand All @@ -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") ||
Expand Down
1 change: 0 additions & 1 deletion docker/integration.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 790aa34

Please sign in to comment.