2024-09-24 06:17:11 -04:00
|
|
|
FROM golang:1.21-alpine AS builder
|
|
|
|
LABEL authors="Nite07"
|
|
|
|
|
2024-11-15 02:02:45 -05:00
|
|
|
RUN apk add --no-cache git
|
|
|
|
|
2024-09-24 06:17:11 -04:00
|
|
|
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
|
2024-09-25 09:47:13 -04:00
|
|
|
ARG version=dev
|
2024-11-15 02:02:45 -05:00
|
|
|
RUN if [ "$version" = "dev" ]; then \
|
|
|
|
version=$(git describe --tags --always); \
|
|
|
|
fi && \
|
|
|
|
CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w -X github.com/nitezs/pcgamedb/constant.Version=${version}" -o pcgamedb .
|
2024-09-24 06:17:11 -04:00
|
|
|
|
|
|
|
FROM alpine:latest
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /app/pcgamedb /app/pcgamedb
|
|
|
|
|
|
|
|
ENTRYPOINT ["/app/pcgamedb", "server"]
|