09a09d4a68
Phase 1 foundations: - Go backend with Chi router framework - SQLite database with WAL mode and foreign keys - Database migrations for users, roles, credentials, AD connections, schedules, rules, and audit - CLI commands: init, run, install, uninstall, start, stop, migrate, backup, restore, doctor - Configuration loading from environment variables - Centralized logging with file rotation (lumberjack) - Crypto package for Argon2id password hashing and AES-GCM encryption - Auth service with session management - Audit service for event logging - Scheduler with 6-field cron support - REST API routes scaffolded for all major resources - CORS support with localhost defaults for development - Docker support with Dockerfile and docker-compose.yml - Multi-platform build script (PowerShell) - Project structure per design specification Version format: yyyy.MM.dd.HHmm All PKs are UUIDv4, all timestamps UTC
65 lines
1.5 KiB
Docker
65 lines
1.5 KiB
Docker
# OrchestrAD Docker Image
|
|
# Multi-stage build for minimal final image
|
|
|
|
# Build stage
|
|
FROM golang:1.22-alpine AS builder
|
|
|
|
RUN apk add --no-cache git gcc musl-dev
|
|
|
|
WORKDIR /build
|
|
|
|
# Copy go.mod first for better caching
|
|
COPY backend/go.mod backend/go.sum* ./
|
|
RUN go mod download
|
|
|
|
# Copy source
|
|
COPY backend/ ./
|
|
|
|
# Build with version info
|
|
ARG VERSION=dev
|
|
ARG BUILD_TIME=unknown
|
|
ARG GIT_COMMIT=unknown
|
|
|
|
RUN CGO_ENABLED=1 go build \
|
|
-ldflags "-s -w \
|
|
-X github.com/Grace-Solutions/OrchestrAD/internal/version.Version=${VERSION} \
|
|
-X github.com/Grace-Solutions/OrchestrAD/internal/version.BuildTime=${BUILD_TIME} \
|
|
-X github.com/Grace-Solutions/OrchestrAD/internal/version.GitCommit=${GIT_COMMIT}" \
|
|
-o /orchestrad ./cmd/orchestrad
|
|
|
|
# Final stage
|
|
FROM alpine:3.19
|
|
|
|
RUN apk add --no-cache ca-certificates tzdata
|
|
|
|
# Create non-root user
|
|
RUN addgroup -g 1000 orchestrad && \
|
|
adduser -u 1000 -G orchestrad -D orchestrad
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy binary
|
|
COPY --from=builder /orchestrad /app/orchestrad
|
|
|
|
# Create data directories
|
|
RUN mkdir -p /data/logs /data/backups && \
|
|
chown -R orchestrad:orchestrad /data
|
|
|
|
# Default environment
|
|
ENV ORCHESTRAD_DATA_PATH=/data
|
|
ENV ORCHESTRAD_LOG_LEVEL=info
|
|
|
|
# Expose port
|
|
EXPOSE 8080
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/health || exit 1
|
|
|
|
# Switch to non-root user
|
|
USER orchestrad
|
|
|
|
# Default to foreground mode
|
|
ENTRYPOINT ["/app/orchestrad"]
|
|
CMD ["run"]
|