This repository has been archived by the owner on Sep 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
96557f8
commit 1ec4149
Showing
1 changed file
with
16 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,29 @@ | ||
FROM golang:alpine AS builder | ||
FROM golang:1.19.2-alpine3.16 as builder | ||
|
||
LABEL stage=gobuilder | ||
|
||
RUN apk add --no-cache git build-base linux-headers | ||
|
||
WORKDIR /build | ||
WORKDIR /app | ||
|
||
# download and cache go mod | ||
COPY ./go.* ./ | ||
|
||
ADD go.mod . | ||
ADD go.sum . | ||
RUN go env -w GO111MODULE=on && go mod download | ||
|
||
COPY . . | ||
RUN go build -ldflags="-s -w" -o /app/main cmd/main.go | ||
|
||
RUN make build | ||
|
||
FROM scratch | ||
|
||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt | ||
COPY --from=builder /usr/share/zoneinfo/Asia/Shanghai /usr/share/zoneinfo/Asia/Shanghai | ||
ENV TZ Asia/Shanghai | ||
FROM alpine:3.16 | ||
|
||
WORKDIR /app | ||
COPY --from=builder /app/main /app/main | ||
|
||
CMD ["./main"] | ||
WORKDIR root | ||
|
||
COPY --from=builder /app/build/bin/firewalld /usr/bin/firewalld | ||
|
||
|
||
VOLUME ["/root"] | ||
|
||
ENTRYPOINT ["firewalld"] |