Something went wrong. Try again.
notes and lists
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748# Build stageFROM golang:1.25-alpine AS builder
# Install build dependencies for SQLite3RUN apk add --no-cache gcc musl-dev sqlite-dev
WORKDIR /app
# Copy go mod files first for dependency cachingCOPY go.mod go.sum ./RUN go mod download
# Copy only Go source code before building# This ensures changes to public/ (static assets) don't invalidate the go build cacheCOPY main.go .COPY handlers/ ./handlers/COPY pkg/ ./pkg/COPY token/ ./token/
# Build the binary with CGO enabled for SQLite3RUN CGO_ENABLED=1 GOOS=linux go build -o pockist .
# Copy static assets AFTER the build so public/ changes don't invalidate the go build cache# The final stage will pull both the binary and public/ from this builder stageCOPY public/ ./public/
# Final stageFROM alpine:latest
# Install SQLite runtime dependencyRUN apk add --no-cache ca-certificates sqlite-libs
WORKDIR /app
# Copy the binary and static assets from builderCOPY --from=builder /app/pockist .COPY --from=builder /app/public ./public
# Create a directory for the SQLite databaseRUN mkdir -p /app/data
# Declare volume for persistent data (shares, imports)VOLUME ["/app/data"]
EXPOSE 4242
CMD ["./pockist"]