simple-go-action/Dockerfile

23 lines
469 B
Docker

# Use the official Golang image as the base image
FROM golang:1.20
# Set the working directory inside the container
WORKDIR /app
# Copy the Go module files
COPY go.mod go.sum ./
# Set Go proxy to goproxy.cn
RUN go env -w GOPROXY=https://goproxy.cn,direct
# Download the Go module dependencies
RUN go mod download
# Copy the rest of the application code
COPY . .
# Build the Go application
RUN go build -o app
# Set the entry point for the container
CMD ["./app"]