game-crawler/Dockerfile
nite07 304517e241
Some checks failed
release / goreleaser (push) Failing after 2m23s
docker / prepare-and-build (push) Failing after 2m55s
trans to private
2024-11-20 19:09:04 +08:00

23 lines
562 B
Docker

FROM golang:1.23-alpine AS builder
LABEL authors="Nite07"
RUN apk add --no-cache git
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go install github.com/swaggo/swag/cmd/swag@latest
RUN swag init
ARG version=dev
RUN if [ "$version" = "dev" ]; then \
version=$(git describe --tags --always); \
fi && \
CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w -X pcgamedb/constant.Version=${version}" -o pcgamedb .
FROM alpine:latest
WORKDIR /app
COPY --from=builder /app/pcgamedb /app/pcgamedb
ENTRYPOINT ["/app/pcgamedb", "server"]