game-crawler/Dockerfile

23 lines
582 B
Docker
Raw Permalink Normal View History

FROM golang:1.23-alpine AS builder
2024-09-24 06:17:11 -04:00
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 && \
2024-12-26 08:09:00 -05:00
CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w -X game-crawler/constant.Version=${version}" -o game-crawler .
2024-09-24 06:17:11 -04:00
FROM alpine:latest
WORKDIR /app
2024-12-26 08:09:00 -05:00
COPY --from=builder /app/game-crawler /app/game-crawler
2024-09-24 06:17:11 -04:00
2024-12-26 08:09:00 -05:00
ENTRYPOINT ["/app/game-crawler", "server"]