# Use an official Go runtime as a parent image FROM golang:1.25.5-alpine # Set the working directory in the container WORKDIR /app # Copy the go mod and sum files to download dependencies COPY go.mod go.sum ./ # Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed RUN go mod download # Copy the source code from the current directory to the working directory inside the container COPY . . # Command to run the application CMD ["go", "run", "main.go"]