Fixed multi-platform builds (#178)
This commit is contained in:
+5
-1
@@ -1,5 +1,9 @@
|
||||
FROM golang:1.16-alpine as builder
|
||||
|
||||
ARG TARGETPLATFORM
|
||||
ARG TARGETARCH
|
||||
RUN echo building for "$TARGETPLATFORM"
|
||||
|
||||
WORKDIR /workspace
|
||||
|
||||
# Copy the Go Modules manifests
|
||||
@@ -16,7 +20,7 @@ COPY test/ test/
|
||||
COPY tools/ tools/
|
||||
COPY version/ version/
|
||||
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o livekit-server ./cmd/server
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH GO111MODULE=on go build -a -o livekit-server ./cmd/server
|
||||
|
||||
FROM alpine
|
||||
|
||||
|
||||
+5
-14
@@ -95,27 +95,18 @@ func BuildLinux() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// builds docker image for LiveKit server
|
||||
func Docker() error {
|
||||
mg.Deps(generateWire)
|
||||
cmd := exec.Command("docker", "build", ".", "-t", fmt.Sprintf("%s:v%s", imageName, version.Version))
|
||||
connectStd(cmd)
|
||||
if err := cmd.Run(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// builds and publish snapshot docker image
|
||||
func PublishDocker() error {
|
||||
mg.Deps(Docker)
|
||||
|
||||
// don't publish snapshot versions as latest or minor version
|
||||
if !strings.Contains(version.Version, "SNAPSHOT") {
|
||||
return errors.New("Cannot publish non-snapshot versions")
|
||||
}
|
||||
|
||||
versionImg := fmt.Sprintf("%s:v%s", imageName, version.Version)
|
||||
cmd := exec.Command("docker", "push", versionImg)
|
||||
cmd := exec.Command("docker", "buildx", "build",
|
||||
"--push", "--platform", "linux/amd64,linux/arm64",
|
||||
"--tag", versionImg,
|
||||
".")
|
||||
connectStd(cmd)
|
||||
if err := cmd.Run(); err != nil {
|
||||
return err
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
package version
|
||||
|
||||
const Version = "0.14.0"
|
||||
const Version = "0.14.1-SNAPSHOT"
|
||||
|
||||
Reference in New Issue
Block a user