Skip to content

Commit 685eb8e

Browse files
committed
fix: allow the project to complete the build in the docker
1 parent f583b9b commit 685eb8e

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

Dockerfile

+14-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
FROM alpine:3.15.0 as certs
22
RUN apk --update add ca-certificates
33

4+
FROM golang:1.18.0-alpine3.15 AS builder
5+
RUN apk add git bash gcc musl-dev upx
6+
WORKDIR /app
7+
COPY . .
8+
RUN go mod tidy
9+
RUN go test -v ./...
10+
ENV CGO_ENABLED=0
11+
RUN GOARCH=amd64 go build -ldflags "-w -s" -v ./...
12+
RUN upx -9 -o grimd.minify grimd && mv grimd.minify grimd
13+
414
FROM scratch
515
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
6-
COPY grimd /usr/bin/grimd
7-
EXPOSE 53/udp
8-
EXPOSE 53/tcp
9-
EXPOSE 8080/tcp
16+
COPY --from=builder /app/grimd /usr/bin/grimd
17+
EXPOSE 53:53/udp
18+
EXPOSE 53:53/tcp
19+
EXPOSE 8080
1020
ENTRYPOINT ["/usr/bin/grimd"]

0 commit comments

Comments
 (0)