real-ip-request-printer/Dockerfile

26 lines
429 B
Docker
Raw Permalink Normal View History

2024-11-08 17:23:44 +03:00
# Build stage
FROM golang:1.23-alpine AS builder
WORKDIR /app
# Copy and download dependencies
# COPY go.mod go.sum ./
COPY go.mod ./
RUN go mod download
# Copy the source code
COPY . .
# Build the application
RUN go build -o main .
# Runtime stage
FROM alpine:latest
WORKDIR /root/
COPY --from=builder /app/main .
# Expose the port the service will run on
EXPOSE 8080
# Command to run the executable
ENTRYPOINT ["./main"]