add: dockerfile

This commit is contained in:
2024-10-28 16:07:56 +08:00
parent 369b658d60
commit 2afcac48dc
3 changed files with 75 additions and 0 deletions

14
Dockerfile Normal file
View File

@@ -0,0 +1,14 @@
FROM golang:1.23 as builder
LABEL authors="nite07"
WORKDIR /app
COPY . .
RUN go mod download
ARG version
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w -X live-streamer/constant.Version=${version}" -o live-streamer .
FROM alpine:latest
COPY --from=builder /app/live-streamer /app/live-streamer
EXPOSE 8080
VOLUME [ "/app/config.json" ]
CMD ["/app/live-streamer"]