This commit is contained in:
18
Dockerfile
18
Dockerfile
@@ -1,3 +1,17 @@
|
||||
FROM golang:1.26.1-alpine AS builder
|
||||
|
||||
RUN apk add --no-cache git
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
|
||||
go build -trimpath -ldflags="-s -w" -o history-api ./cmd/history-api
|
||||
|
||||
FROM alpine:latest
|
||||
|
||||
RUN apk --no-cache add ca-certificates tzdata
|
||||
@@ -5,9 +19,11 @@ ENV TZ=Asia/Ho_Chi_Minh
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY build/history-api .
|
||||
COPY --from=builder /app/history-api .
|
||||
COPY data ./data
|
||||
|
||||
RUN chmod +x ./history-api
|
||||
|
||||
EXPOSE 3344
|
||||
|
||||
CMD ["./history-api"]
|
||||
Reference in New Issue
Block a user