2024-11-28 16:17:25 +00:00
|
|
|
FROM golang:1.23-alpine AS builder
|
2021-07-02 22:12:47 +00:00
|
|
|
#
|
|
|
|
# Include dist
|
2022-03-08 23:36:03 +00:00
|
|
|
COPY dist/ /root/dist/
|
2021-07-02 22:12:47 +00:00
|
|
|
#
|
2024-09-11 10:42:17 +00:00
|
|
|
# Install packages
|
|
|
|
RUN apk --no-cache -U add \
|
2024-03-05 18:50:35 +00:00
|
|
|
build-base \
|
|
|
|
git \
|
|
|
|
g++ && \
|
2021-07-02 22:12:47 +00:00
|
|
|
#
|
|
|
|
# Setup go, hellpot
|
2021-07-03 15:51:32 +00:00
|
|
|
cd /root && \
|
2021-07-02 22:12:47 +00:00
|
|
|
git clone https://github.com/yunginnanet/HellPot && \
|
|
|
|
cd HellPot && \
|
2024-11-28 16:17:25 +00:00
|
|
|
git checkout c48b70110148918255f93df4fa49c675ba5a5754 && \
|
2022-10-14 14:55:28 +00:00
|
|
|
sed -i 's#logFileName := "HellPot"#logFileName := "hellpot"#g' internal/config/logger.go && \
|
2024-03-05 18:50:35 +00:00
|
|
|
go mod download && \
|
|
|
|
go vet -v ./... && \
|
|
|
|
go test -v ./... && \
|
|
|
|
export CGO_ENABLED=0 && \
|
|
|
|
export VERSION=`git tag --sort=-version:refname | head -n 1` && \
|
|
|
|
go build -trimpath \
|
|
|
|
-ldflags "-s -w -X main.version=$VERSION" \
|
|
|
|
cmd/HellPot/HellPot.go
|
|
|
|
#
|
2024-11-28 16:17:25 +00:00
|
|
|
FROM scratch
|
2024-03-05 18:50:35 +00:00
|
|
|
#
|
|
|
|
COPY --from=builder /root/HellPot/HellPot /opt/hellpot/
|
|
|
|
COPY --from=builder /root/dist/config.toml /opt/hellpot/config/
|
2021-07-02 22:12:47 +00:00
|
|
|
#
|
|
|
|
# Start hellpot
|
|
|
|
WORKDIR /opt/hellpot
|
2024-11-28 16:17:25 +00:00
|
|
|
USER 2000:2000
|
2024-03-05 18:50:35 +00:00
|
|
|
CMD ["./HellPot", "-c","config/config.toml"]
|