builds docker image
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
|||||||
|
FROM golang:alpine as builder
|
||||||
|
|
||||||
|
WORKDIR /workspace
|
||||||
|
# Copy the Go Modules manifests
|
||||||
|
COPY go.mod go.mod
|
||||||
|
COPY go.sum go.sum
|
||||||
|
# cache deps before building and copying source so that we don't need to re-download as much
|
||||||
|
# and so that source changes don't invalidate our downloaded layer
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
# Copy the go source
|
||||||
|
COPY cmd/ cmd/
|
||||||
|
COPY pkg/ pkg/
|
||||||
|
COPY proto/ proto/
|
||||||
|
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
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
|
||||||
|
COPY --from=builder /workspace/livekit-server /livekit-server
|
||||||
|
|
||||||
|
# Run the binary.
|
||||||
|
ENTRYPOINT ["/livekit-server"]
|
||||||
@@ -22,6 +22,7 @@ import (
|
|||||||
"github.com/livekit/livekit-server/pkg/routing"
|
"github.com/livekit/livekit-server/pkg/routing"
|
||||||
"github.com/livekit/livekit-server/pkg/service"
|
"github.com/livekit/livekit-server/pkg/service"
|
||||||
"github.com/livekit/livekit-server/pkg/utils"
|
"github.com/livekit/livekit-server/pkg/utils"
|
||||||
|
"github.com/livekit/livekit-server/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -67,6 +68,7 @@ func main() {
|
|||||||
Action: generateKeys,
|
Action: generateKeys,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Version: version.Version,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := app.Run(os.Args); err != nil {
|
if err := app.Run(os.Args); err != nil {
|
||||||
|
|||||||
+14
-2
@@ -7,15 +7,16 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"go/build"
|
"go/build"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/livekit/livekit-server/version"
|
||||||
"github.com/magefile/mage/mg"
|
"github.com/magefile/mage/mg"
|
||||||
"github.com/magefile/mage/target"
|
"github.com/magefile/mage/target"
|
||||||
log "github.com/pion/ion-log"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -134,6 +135,17 @@ func Build() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// builds docker image for LiveKit server
|
||||||
|
func BuildDocker() error {
|
||||||
|
mg.Deps(Proto, generateWire)
|
||||||
|
cmd := exec.Command("docker", "build", ".", "-t", "livekit/livekit:v"+version.Version)
|
||||||
|
connectStd(cmd)
|
||||||
|
if err := cmd.Run(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// run unit tests, skipping integration
|
// run unit tests, skipping integration
|
||||||
func Test() error {
|
func Test() error {
|
||||||
mg.Deps(Proto)
|
mg.Deps(Proto)
|
||||||
@@ -296,7 +308,7 @@ func NewChecksummer(dir string, checksumfile string, exts ...string) *Checksumme
|
|||||||
func (c *Checksummer) IsChanged() bool {
|
func (c *Checksummer) IsChanged() bool {
|
||||||
// default changed
|
// default changed
|
||||||
if err := c.computeChecksum(); err != nil {
|
if err := c.computeChecksum(); err != nil {
|
||||||
log.Errorf("could not compute checksum: %v", err)
|
log.Println("could not compute checksum", err)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// read
|
// read
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
package version
|
||||||
|
|
||||||
|
const Version = "0.1.1"
|
||||||
Reference in New Issue
Block a user