fix: add go.sum and fixes

This commit is contained in:
2026-02-06 14:26:15 -03:00
parent cf2b4f7b91
commit d6b08cb586
36 changed files with 3613 additions and 423 deletions

View File

@@ -1,13 +1,59 @@
# ═══════════════════════════════════════════════════════════
# 🐍 OPHION Server - Dockerfile
# ═══════════════════════════════════════════════════════════
# Build stage
FROM golang:1.22-alpine AS builder
WORKDIR /app
WORKDIR /build
# Install dependencies
RUN apk add --no-cache git ca-certificates
# Copy go modules first (cache layer)
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o ophion-server ./cmd/server
# Copy source code
COPY cmd/ ./cmd/
COPY internal/ ./internal/
# Build the server binary
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -ldflags="-s -w" -o ophion-server ./cmd/server
# Runtime stage
FROM alpine:3.19
RUN apk --no-cache add ca-certificates
LABEL org.opencontainers.image.title="OPHION Server"
LABEL org.opencontainers.image.description="Observability Platform API Server"
# Install runtime dependencies
RUN apk add --no-cache ca-certificates tzdata wget
# Create non-root user
RUN addgroup -g 1000 ophion && \
adduser -u 1000 -G ophion -s /bin/sh -D ophion
WORKDIR /app
COPY --from=builder /app/ophion-server .
# Copy binary from builder
COPY --from=builder /build/ophion-server /app/
# Create data directories
RUN mkdir -p /app/data /app/logs && \
chown -R ophion:ophion /app
USER ophion
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD wget -q --spider http://localhost:8080/health || exit 1
# Environment defaults
ENV TZ=America/Sao_Paulo \
PORT=8080
EXPOSE 8080
CMD ["./ophion-server"]
ENTRYPOINT ["/app/ophion-server"]