docs: update Dockerfile to use Go modules and go install

pull/2002/head
Alex Soares 4 months ago
parent 76f9cea516
commit ebf47f4443

@ -126,19 +126,20 @@ in a volume that may be mounted onto your watchtower container.
```Dockerfile ```Dockerfile
FROM golang:1.20 FROM golang:1.20
ENV GO111MODULE off # Enable Go modules and disable CGO
ENV CGO_ENABLED 0 ENV GO111MODULE=on
ENV REPO github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login ENV CGO_ENABLED=0
# Define the repository to install from
ENV REPO=github.com/awslabs/amazon-ecr-credential-helper/ecr-login/cli/docker-credential-ecr-login@latest
RUN go get -u $REPO # Install the necessary dependencies and build the binary
RUN go install $REPO
RUN rm /go/bin/docker-credential-ecr-login
RUN go build \
-o /go/bin/docker-credential-ecr-login \
/go/src/$REPO
# Set the final working directory
WORKDIR /go/bin/ WORKDIR /go/bin/
# Set the default command
CMD ["docker-credential-ecr-login"]
``` ```
2. Use the following commands to build the aws-ecr-dock-cred-helper and store it's output in a volume: 2. Use the following commands to build the aws-ecr-dock-cred-helper and store it's output in a volume:

Loading…
Cancel
Save