full_container_scheme/2.docker/dockerfile.build-golang

17 lines
385 B
Plaintext

FROM golang:1.22.5 AS builder
COPY . /app
WORKDIR /app
RUN GOPROXY='https://goproxy.io',direct CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -o app main.go
FROM alpine:3.10
ENV TZ Asia/Shanghai
# RUN apk add --no-cache tzdata && \
# ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN apk add --no-cache tzdata
COPY --from=builder /app /
EXPOSE 8080
CMD ["./app"]