Install dependencies in a separate step

This commit is contained in:
Gabe Cook 2025-03-17 01:20:15 -05:00
parent 92f89bb313
commit 0b34f6181f
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 -ldflags='-w -s' -o /WatchYourLAN .
WORKDIR /src
COPY go.mod go.sum .
RUN go mod download
COPY . .
WORKDIR /src/cmd/WatchYourLAN
RUN CGO_ENABLED=0 go build -ldflags='-w -s' -o /WatchYourLAN .
FROM alpine