Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow the project to complete the build in the docker #95

Merged
merged 1 commit into from
Mar 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
FROM alpine:3.15.0 as certs
RUN apk --update add ca-certificates

FROM golang:1.18.0-alpine3.15 AS builder
RUN apk add git bash gcc musl-dev upx
WORKDIR /app
COPY . .
RUN go mod tidy
RUN go test -v ./...
ENV CGO_ENABLED=0
RUN GOARCH=amd64 go build -ldflags "-w -s" -v ./...
RUN upx -9 -o grimd.minify grimd && mv grimd.minify grimd

FROM scratch
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY grimd /usr/bin/grimd
EXPOSE 53/udp
EXPOSE 53/tcp
EXPOSE 8080/tcp
COPY --from=builder /app/grimd /usr/bin/grimd
EXPOSE 53:53/udp
EXPOSE 53:53/tcp
EXPOSE 8080
ENTRYPOINT ["/usr/bin/grimd"]