Files
wx_service/Dockerfile
T

23 lines
467 B
Docker

FROM golang:1.23-alpine AS builder
WORKDIR /app
RUN apk add --no-cache git ca-certificates
ENV GOPROXY=https://goproxy.cn,direct
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /wx_service ./cmd/api
FROM alpine:3.20
WORKDIR /app
RUN apk add --no-cache ca-certificates wget && update-ca-certificates
COPY --from=builder /wx_service /app/wx_service
COPY .env /app/.env
EXPOSE 8080
CMD ["/app/wx_service"]