fix: add go.sum and fixes
This commit is contained in:
@@ -25,10 +25,6 @@ COPY internal/ ./internal/
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
|
||||
go build -ldflags="-s -w" -o ophion-server ./cmd/server
|
||||
|
||||
# Build agent
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
|
||||
go build -ldflags="-s -w" -o ophion-agent ./cmd/agent
|
||||
|
||||
# ─────────────────────────────────────────────────────────────
|
||||
# Stage 2: Build Dashboard (Next.js)
|
||||
# ─────────────────────────────────────────────────────────────
|
||||
@@ -38,7 +34,7 @@ WORKDIR /build
|
||||
|
||||
# Dependências
|
||||
COPY dashboard/package*.json ./
|
||||
RUN npm ci --only=production
|
||||
RUN npm install
|
||||
|
||||
# Código fonte
|
||||
COPY dashboard/ ./
|
||||
@@ -76,7 +72,6 @@ WORKDIR /app
|
||||
|
||||
# Copiar binários Go
|
||||
COPY --from=go-builder /build/ophion-server /app/bin/
|
||||
COPY --from=go-builder /build/ophion-agent /app/bin/
|
||||
|
||||
# Copiar Dashboard
|
||||
COPY --from=web-builder /build/.next /app/web/.next
|
||||
|
||||
57
deploy/docker/Dockerfile.agent
Normal file
57
deploy/docker/Dockerfile.agent
Normal file
@@ -0,0 +1,57 @@
|
||||
# ═══════════════════════════════════════════════════════════
|
||||
# 🐍 OPHION Agent - Dockerfile
|
||||
# ═══════════════════════════════════════════════════════════
|
||||
|
||||
# Build stage
|
||||
FROM golang:1.22-alpine AS builder
|
||||
|
||||
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 source code
|
||||
COPY cmd/ ./cmd/
|
||||
COPY internal/ ./internal/
|
||||
|
||||
# Build the agent binary
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
|
||||
go build -ldflags="-s -w" -o ophion-agent ./cmd/agent
|
||||
|
||||
# Runtime stage
|
||||
FROM alpine:3.19
|
||||
|
||||
LABEL org.opencontainers.image.title="OPHION Agent"
|
||||
LABEL org.opencontainers.image.description="Observability Agent - Metrics, Logs, Traces Collector"
|
||||
|
||||
# Install runtime dependencies
|
||||
RUN apk add --no-cache ca-certificates tzdata
|
||||
|
||||
# Create non-root user
|
||||
RUN addgroup -g 1000 ophion && \
|
||||
adduser -u 1000 -G ophion -s /bin/sh -D ophion
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy binary from builder
|
||||
COPY --from=builder /build/ophion-agent /app/
|
||||
|
||||
USER ophion
|
||||
|
||||
# Environment defaults
|
||||
ENV TZ=America/Sao_Paulo \
|
||||
OPHION_SERVER=http://localhost:8080 \
|
||||
OPHION_INTERVAL=30s \
|
||||
OPHION_DOCKER=true \
|
||||
OPHION_LOGS=true \
|
||||
OPHION_OTLP=true \
|
||||
OPHION_OTLP_PORT=4318
|
||||
|
||||
# OTLP receiver port
|
||||
EXPOSE 4318
|
||||
|
||||
ENTRYPOINT ["/app/ophion-agent"]
|
||||
@@ -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"]
|
||||
|
||||
@@ -1,35 +1,24 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
ophion-server:
|
||||
ophion:
|
||||
build:
|
||||
context: ../..
|
||||
dockerfile: deploy/docker/Dockerfile.server
|
||||
dockerfile: deploy/docker/Dockerfile
|
||||
ports:
|
||||
- "8080:8080"
|
||||
- "8090:8080"
|
||||
- "3001:3000"
|
||||
environment:
|
||||
- DATABASE_URL=postgres://ophion:ophion@postgres:5432/ophion
|
||||
- CLICKHOUSE_URL=clickhouse://clickhouse:9000/ophion
|
||||
- REDIS_URL=redis://redis:6379
|
||||
- DATABASE_URL=${DATABASE_URL:-postgres://ophion:ophion@postgres:5432/ophion}
|
||||
- CLICKHOUSE_URL=${CLICKHOUSE_URL:-clickhouse://clickhouse:9000/ophion}
|
||||
- REDIS_URL=${REDIS_URL:-redis://redis:6379}
|
||||
- JWT_SECRET=${JWT_SECRET:-change-me-in-production}
|
||||
- ADMIN_EMAIL=${ADMIN_EMAIL:-admin@ophion.com.br}
|
||||
- ADMIN_PASSWORD=${ADMIN_PASSWORD:-ophion123}
|
||||
depends_on:
|
||||
- postgres
|
||||
- clickhouse
|
||||
- redis
|
||||
restart: unless-stopped
|
||||
|
||||
ophion-web:
|
||||
build:
|
||||
context: ../..
|
||||
dockerfile: deploy/docker/Dockerfile.web
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
- API_URL=http://ophion-server:8080
|
||||
depends_on:
|
||||
- ophion-server
|
||||
restart: unless-stopped
|
||||
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
environment:
|
||||
|
||||
@@ -24,8 +24,11 @@ case "$MODE" in
|
||||
exec npm start
|
||||
;;
|
||||
all)
|
||||
echo "Starting all services with supervisor..."
|
||||
exec supervisord -c /etc/supervisord.conf
|
||||
echo "Starting all services..."
|
||||
# Start server in background
|
||||
/app/bin/ophion-server &
|
||||
# Start web
|
||||
cd /app/web && npm start
|
||||
;;
|
||||
*)
|
||||
echo "Unknown mode: $MODE"
|
||||
|
||||
Reference in New Issue
Block a user