Docker added

This commit is contained in:
2025-12-29 05:19:08 +02:00
parent 75cff3699f
commit d54b0eaddf
4 changed files with 462 additions and 0 deletions

39
Dockerfile Normal file
View File

@@ -0,0 +1,39 @@
# Build stage
FROM golang:1.23-alpine AS builder
# Install build dependencies (SQLite requires CGO)
RUN apk add --no-cache gcc musl-dev sqlite-dev
WORKDIR /build
# Copy go mod files
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Build the server binary
# CGO is required for mattn/go-sqlite3
RUN CGO_ENABLED=1 GOOS=linux go build -a -installsuffix cgo -o whatshooked-server ./cmd/server
# Runtime stage
FROM alpine:latest
# Install runtime dependencies
RUN apk add --no-cache ca-certificates sqlite-libs tzdata
WORKDIR /app
# Copy binary from builder
COPY --from=builder /build/whatshooked-server .
# Create necessary directories
RUN mkdir -p /app/sessions /app/data/media
# Expose the default server port
EXPOSE 8080
# Run the server
ENTRYPOINT ["/app/whatshooked-server"]
CMD ["-config", "/app/config.json"]