Skip to content

Commit bdeafd6

Browse files
committed
Add multistage build
1 parent b6edd93 commit bdeafd6

File tree

8 files changed

+20
-2
lines changed

8 files changed

+20
-2
lines changed

Dockerfile.build

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM golang:1.12 AS builder
2+
3+
ENV CGO_ENABLED=0
4+
5+
WORKDIR /build
6+
7+
COPY go.mod /build/go.mod
8+
RUN go mod download
9+
10+
COPY cmd /build/cmd
11+
COPY pkg /build/pkg
12+
RUN go build -o mc-router cmd/mc-router/main.go
13+
14+
FROM scratch
15+
16+
COPY --from=builder /build/mc-router /bin/mc-router
17+
18+
ENTRYPOINT ["/bin/mc-router"]

cmd/mc-router/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"flag"
66
"fmt"
7-
"github.com/itzg/mc-router/server"
7+
"github.com/itzg/mc-router/pkg/server"
88
"github.com/sirupsen/logrus"
99
"net"
1010
"os"
File renamed without changes.
File renamed without changes.

server/connector.go renamed to pkg/server/connector.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package server
33
import (
44
"net"
55
"github.com/sirupsen/logrus"
6-
"github.com/itzg/mc-router/mcproto"
6+
"github.com/itzg/mc-router/pkg/mcproto"
77
"context"
88
"io"
99
"bytes"
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)