diff --git a/guestbook-go/Dockerfile b/guestbook-go/Dockerfile index bf25e7db..e8f737c4 100644 --- a/guestbook-go/Dockerfile +++ b/guestbook-go/Dockerfile @@ -12,17 +12,27 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM golang:1.10.0 +FROM golang:1.18 AS builder + + +WORKDIR /app + + +RUN go mod init temp-module || true RUN go get github.com/codegangsta/negroni \ github.com/gorilla/mux \ github.com/xyproto/simpleredis/v2 -WORKDIR /app -ADD ./main.go . + + +COPY ./main.go . + + RUN CGO_ENABLED=0 GOOS=linux go build -o main . + FROM scratch WORKDIR /app -COPY --from=0 /app/main . +COPY --from=builder /app/main . COPY ./public/index.html public/index.html COPY ./public/script.js public/script.js COPY ./public/style.css public/style.css