tpotce/docker/hellpot/Dockerfile

37 lines
980 B
Text
Raw Normal View History

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
2024-12-05 21:39:01 +00:00
RUN apk --no-cache -U upgrade && \
apk --no-cache -U add \
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 && \
git checkout c48b70110148918255f93df4fa49c675ba5a5754 && \
2022-10-14 14:55:28 +00:00
sed -i 's#logFileName := "HellPot"#logFileName := "hellpot"#g' internal/config/logger.go && \
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
#
FROM scratch
#
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
USER 2000:2000
CMD ["./HellPot", "-c","config/config.toml"]