Install dependencies before build to improve Docker build time

This commit is contained in:
Gabe Cook 2025-03-17 01:20:15 -05:00
parent a3d86cb7d7
commit a986a2ae0f
No known key found for this signature in database
GPG key ID: 3197318BDE319B8D

View file

@ -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