19 lines
405 B
Docker
19 lines
405 B
Docker
# Use the official Golang image as a base image
|
|
FROM golang:1.22.5-alpine
|
|
|
|
# Set the working directory inside the container
|
|
WORKDIR /app
|
|
|
|
# Copy the Go application into the container
|
|
COPY . .
|
|
|
|
RUN go env -w GO111MODULE=on && go env -w GOPROXY=https://goproxy.cn
|
|
|
|
# Build the Go application
|
|
RUN go build -ldflags="-s -w" -o app main.go
|
|
|
|
|
|
FROM alpine:latest
|
|
COPY --from=0 /app/app /app/app
|
|
|
|
CMD ["/app/app"] |