- Add development and production configuration templates - Include Docker build files for containerized deployment - Add Nginx configuration with SSL/TLS setup - Include environment configuration examples - Add SSL certificate setup and management - Configure application schemas and validation - Support for both local and production deployment scenarios Provides flexible deployment options from development to production with proper security, monitoring, and configuration management.
71 lines
1.5 KiB
Docker
71 lines
1.5 KiB
Docker
# Multi-stage build for ML Experiment Manager
|
|
FROM golang:1.25-alpine AS go-builder
|
|
|
|
# Install dependencies
|
|
RUN apk add --no-cache git make podman redis
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy go mod files
|
|
COPY go.mod go.sum ./
|
|
|
|
# Download dependencies
|
|
RUN go mod download
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build Go binaries
|
|
RUN make build
|
|
|
|
# Zig CLI stage
|
|
FROM alpine:3.19 AS zig-builder
|
|
|
|
# Install dependencies
|
|
RUN apk add --no-cache curl xz
|
|
|
|
# Install Zig
|
|
RUN curl -L https://ziglang.org/download/0.15.2/zig-linux-aarch64-0.15.2.tar.xz | tar -xJ -C /opt
|
|
ENV PATH="/opt/zig-linux-aarch64-0.15.2:${PATH}"
|
|
|
|
# Copy CLI source
|
|
COPY cli/ /app/cli/
|
|
|
|
# Build Zig CLI
|
|
WORKDIR /app/cli
|
|
RUN zig build cross
|
|
|
|
# Final stage
|
|
FROM alpine:3.19
|
|
|
|
# Install runtime dependencies
|
|
RUN apk add --no-cache ca-certificates rsync openssh-client redis
|
|
|
|
# Create app user
|
|
RUN addgroup -g 1001 -S appgroup && \
|
|
adduser -u 1001 -S appuser -G appgroup
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy binaries from builders
|
|
COPY --from=go-builder /app/bin/ /usr/local/bin/
|
|
COPY --from=zig-builder /app/cli/zig-out/bin/ml /usr/local/bin/
|
|
|
|
# Create directories
|
|
RUN mkdir -p /data/ml-experiments /home/appuser/.ml && \
|
|
chown -R appuser:appgroup /data /home/appuser
|
|
|
|
# Switch to app user
|
|
USER appuser
|
|
|
|
# Expose ports
|
|
EXPOSE 9100 9101
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD wget --no-verbose --tries=1 --spider http://localhost:9100/health || exit 1
|
|
|
|
# Default command
|
|
CMD ["/usr/local/bin/api-server"]
|