Add .dockerignore and adjust Dockerfile
This commit is contained in:
parent
52373cff45
commit
3eec47c0b0
|
|
@ -0,0 +1,5 @@
|
||||||
|
*.log
|
||||||
|
output.*.txt
|
||||||
|
.vscode
|
||||||
|
files
|
||||||
|
files.*/
|
||||||
20
Dockerfile
20
Dockerfile
|
|
@ -1,11 +1,19 @@
|
||||||
|
ARG bin_name=docgrouper
|
||||||
|
|
||||||
FROM golang:1.22 as builder
|
FROM golang:1.22 as builder
|
||||||
WORKDIR /go/src/docgrouper
|
ARG bin_name
|
||||||
COPY testdata testdata/
|
WORKDIR /go/src/$bin_name
|
||||||
COPY *.go go.mod go.sum ./
|
COPY . .
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
RUN go test -v ./... && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o docgroup
|
RUN go test -v ./... && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $bin_name
|
||||||
|
|
||||||
FROM gcr.io/distroless/base-nossl-debian12
|
FROM gcr.io/distroless/base-nossl-debian12
|
||||||
COPY --from=builder /go/src/docgrouper/docgrouper /bin/docgrouper
|
ARG bin_name
|
||||||
|
COPY --from=builder /go/src/${bin_name}/${bin_name} /bin/${bin_name}
|
||||||
VOLUME [ "/files" ]
|
VOLUME [ "/files" ]
|
||||||
ENTRYPOINT [ "docgroup" ]
|
|
||||||
|
# ARGs are stupid and cannot be used in ENTRYPOINT, so we still have to
|
||||||
|
# hard-code the binary name here, but this is still better than having to
|
||||||
|
# hard-code it in the stages above, since it doesn't really matter much what the
|
||||||
|
# entrypoint is called.
|
||||||
|
ENTRYPOINT [ "docgrouper" ]
|
||||||
Loading…
Reference in New Issue