From 0d9b440cd6c3285b63bd99e7efed1fabb419f28c Mon Sep 17 00:00:00 2001 From: Theo Bob Massard Date: Fri, 17 Feb 2023 10:55:30 +0100 Subject: [PATCH] Use COPY instead of ADD in Dockerfiles COPY is simpler and less error-prone when not interacting with archives or remote URL content Signed-off-by: Theo Bob Massard --- doc_source/go-image.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc_source/go-image.md b/doc_source/go-image.md index d599bfbf..c124fa70 100644 --- a/doc_source/go-image.md +++ b/doc_source/go-image.md @@ -76,10 +76,10 @@ Note that the first three steps are identical whether you deploy your function a RUN yum install -y golang RUN go env -w GOPROXY=direct # cache dependencies - ADD go.mod go.sum ./ + COPY go.mod go.sum ./ RUN go mod download # build - ADD . . + COPY . . RUN go build -o /main # copy artifacts to a clean image FROM public.ecr.aws/lambda/provided:al2 @@ -118,10 +118,10 @@ FROM alpine as build RUN apk add go git RUN go env -w GOPROXY=direct # cache dependencies -ADD go.mod go.sum ./ +COPY go.mod go.sum ./ RUN go mod download # build -ADD . . +COPY . . RUN go build -o /main # copy artifacts to a clean image FROM alpine