mirror of
https://github.com/btouchard/ackify.git
synced 2026-02-11 08:19:22 -06:00
- Move web server logic to pkg/web package for external imports - Rename cmd/ackify to cmd/community for clarity - Create NewServer(multitenant bool) function for EE integration - Add basic unit tests for Community Edition - Update Dockerfile to build from cmd/community - Add comprehensive build and deployment documentation This change enables the Enterprise Edition to import and extend the Community Edition while maintaining clean separation.
63 lines
1.7 KiB
Docker
63 lines
1.7 KiB
Docker
# ---- Build stage ----
|
|
FROM golang:alpine AS builder
|
|
|
|
# Install security updates and ca-certificates
|
|
RUN apk update && apk add --no-cache ca-certificates git && rm -rf /var/cache/apk/*
|
|
|
|
# Create non-root user for build
|
|
RUN adduser -D -g '' ackuser
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy go mod files first for better layer caching
|
|
COPY go.mod go.sum ./
|
|
|
|
# Set GOTOOLCHAIN to auto to allow Go toolchain updates
|
|
ENV GOTOOLCHAIN=auto
|
|
|
|
RUN go mod download && go mod verify
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build arguments for metadata
|
|
ARG VERSION="dev"
|
|
ARG COMMIT="unknown"
|
|
ARG BUILD_DATE="unknown"
|
|
|
|
# Build the application with optimizations and metadata
|
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
|
|
-a -installsuffix cgo \
|
|
-ldflags="-w -s -X main.Version=${VERSION} -X main.Commit=${COMMIT} -X main.BuildDate=${BUILD_DATE}" \
|
|
-o ackify-ce ./cmd/community
|
|
|
|
# ---- Runtime stage ----
|
|
FROM gcr.io/distroless/static-debian12:nonroot
|
|
|
|
# Re-declare ARG for runtime stage
|
|
ARG VERSION="dev"
|
|
|
|
# Add metadata labels
|
|
LABEL maintainer="Benjamin TOUCHARD"
|
|
LABEL version="${VERSION}"
|
|
LABEL description="Ackify - Document signature validation platform"
|
|
LABEL org.opencontainers.image.source="https://github.com/btouchard/ackify-ce"
|
|
LABEL org.opencontainers.image.description="Professional solution for validating and tracking document reading"
|
|
LABEL org.opencontainers.image.licenses="SSPL"
|
|
|
|
# Copy certificates for HTTPS requests
|
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
|
|
|
# Set working directory and copy application files
|
|
WORKDIR /app
|
|
COPY --from=builder /app/ackify-ce /app/ackify-ce
|
|
COPY --from=builder /app/web /app/web
|
|
|
|
# Use non-root user (already set in distroless image)
|
|
# USER 65532:65532
|
|
|
|
EXPOSE 8080
|
|
|
|
|
|
ENTRYPOINT ["/app/ackify-ce"]
|