From a986a2ae0facf583078b631a6877eeb6e6560863 Mon Sep 17 00:00:00 2001 From: Gabe Cook Date: Mon, 17 Mar 2025 01:20:15 -0500 Subject: [PATCH] Install dependencies before build to improve Docker build time --- Dockerfile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index af7aeea..f949a34 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,14 @@ FROM golang:alpine AS builder RUN apk add build-base -COPY . /src -RUN cd /src/cmd/WatchYourLAN/ && CGO_ENABLED=0 go build -o /WatchYourLAN . + +WORKDIR /src +COPY go.mod go.sum . +RUN go mod download + +COPY . . +WORKDIR /src/cmd/WatchYourLAN +RUN CGO_ENABLED=0 go build -o /WatchYourLAN . FROM alpine