-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
23 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
FROM golang:1.22-alpine AS build | ||
WORKDIR /go/src/github.com/utilitywarehouse/registry-browser | ||
COPY . /go/src/github.com/utilitywarehouse/registry-browser | ||
ENV CGO_ENABLED 0 | ||
RUN apk --no-cache add git \ | ||
&& go get -t ./... \ | ||
&& go test ./... \ | ||
&& go build -o /registry-browser . | ||
FROM golang:1.23-alpine AS build | ||
|
||
WORKDIR /workspace | ||
# Copy the Go Modules manifests | ||
COPY go.mod go.mod | ||
COPY go.sum go.sum | ||
# cache deps before building and copying source so that we don't need to re-download as much | ||
# and so that source changes don't invalidate our downloaded layer | ||
RUN go mod download | ||
|
||
# Copy the go source | ||
COPY . . | ||
|
||
RUN go test -v -cover ./... \ | ||
&& CGO_ENABLED=0 go build -o /registry-browser . | ||
|
||
FROM alpine:3.20 | ||
ADD templates /templates | ||
ADD static /static | ||
COPY --from=build /registry-browser /registry-browser | ||
COPY --from=build /workspace/registry-browser /registry-browser | ||
|
||
ENTRYPOINT [ "/registry-browser" ] |