Dockerfile:
# Build stage FROM golang:1.21.5-alpine3.18 AS builder WORKDIR /app COPY . . RUN go env -w GOPROXY=https://goproxy.io,direct RUN go build -o main main.go # Run stage FROM alpine:3.18 WORKDIR /app COPY --from=builder /app/main . COPY app.env . EXPOSE 8080 CMD [ "/app/main"]
zzh@ZZHPC:/zdata/Github/zimplebank$ docker build -t zimplebank:latest .
zzh@ZZHPC:/zdata/Github/zimplebank$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE zimplebank latest 1ab108eea809 About a minute ago 25.4MB
标签:COPY,zimplebank,app,application,Build,go,Docker,main From: https://www.cnblogs.com/zhangzhihui/p/17889122.html