Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(platforms): add alpine support #154

Merged
merged 1 commit into from
Jun 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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