simple-go-action/Dockerfile

23 lines
469 B
Docker
Raw Normal View History

2024-08-13 11:16:26 +08:00
# Use the official Golang image as the base image
FROM golang:1.20
2024-08-13 10:44:42 +08:00
# Set the working directory inside the container
WORKDIR /app
2024-08-13 11:16:26 +08:00
# 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
2024-08-13 10:44:42 +08:00
COPY . .
# Build the Go application
RUN go build -o app
# Set the entry point for the container
2024-08-13 11:16:26 +08:00
CMD ["./app"]