Init Project
All checks were successful
Go CI Pipeline / build_and_test (push) Successful in 11m57s

This commit is contained in:
Enkly
2025-12-09 17:47:21 +01:00
parent d1ebb9fb9b
commit 7a6f64e581
62 changed files with 5238 additions and 0 deletions

32
Dockerfile Normal file
View File

@@ -0,0 +1,32 @@
# Stage 1: Build the Go application
FROM golang:1.25-alpine AS builder
WORKDIR /app
# Copy go.mod and go.sum files to download dependencies
COPY go.mod go.sum ./
RUN go mod download
# Copy the rest of the source code
COPY . .
# Build the application
# CGO_ENABLED=0 is important for a small static binary
# -o /app/server creates the binary in a known location
RUN CGO_ENABLED=0 GOOS=linux go build -o /app/server ./cmd/server
# Stage 2: Create the final, small image
FROM alpine:latest
WORKDIR /app
# Copy the static assets and templates
COPY --from=builder /app/public/assets ./public/assets
COPY --from=builder /app/public/templates ./public/templates
# Copy the compiled binary from the builder stage
COPY --from=builder /app/server .
# Expose the port the app runs on
EXPOSE 8080
# Command to run the executable
CMD ["./server"]