Files
tp/serv_golang_rest_api/Dockerfile
T
valitovgaziz 61c5a70534 modified: Dockerfile
change docker file, simplifiy it
2025-09-25 03:10:50 +05:00

23 lines
365 B
Docker

# Use official Go image with specific version
FROM golang:1.25.1
# Set working directory
WORKDIR /app
# Copy Go module files first
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy source code
COPY *.go ./
# Build the binary
RUN CGO_ENABLED=0 GOOS=linux go build -o main .
# Expose port
EXPOSE 8080
# Run the application
CMD ["./main"]