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