From c28a54bf332727a11bdd7bcc2db2eb0951e9fdc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20Dulai?= Date: Sun, 1 Feb 2026 23:16:13 +0100 Subject: [PATCH] Add basic Dockerfile --- Dockerfile | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e386c13 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,37 @@ +# Use Go 1.25.6 or newer +FROM golang:1.25.6-alpine AS builder + +# Enable Go modules +ENV GO111MODULE=on + +# Set working directory +WORKDIR /app + +# Install git (for go get) and build tools +RUN apk add --no-cache git + +# Copy go.mod and go.sum first for better cache +COPY go.mod go.sum ./ +RUN go mod download + +# Copy the rest of the source code +COPY . . + +# Build the Go app +RUN go build -o app . + +# Stage 2: Create a minimal runtime image +FROM alpine:latest + +# Set working directory +WORKDIR /root/ + +# Copy binary and .env file from builder +COPY --from=builder /app/app . +COPY .env . + +# Expose the port (optional, for documentation) +EXPOSE 8080 + +# Run the binary +CMD ["./app"]