Files
Strix/Dockerfile
T
eduard256 e40dccbb90 Remove CI/CD, unify Docker image for Docker Hub and HA add-on
- Remove GitHub Actions workflows (ci.yml, docker.yml, release.yml)
- Remove GoReleaser configuration
- Remove RELEASE.md (replaced by /release_strix skill)
- Add HA options.json support in config.go (reads /data/options.json)
- Add Version field to Config, pass real version to health endpoint
- Change Version from const to var, inject via ldflags at build time
- Add ARG VERSION to Dockerfile for build-time version injection
- Reset webui/package.json version to 0.0.0 (not used functionally)
- Clear probe fields on back navigation in frontend
- Add /release_strix and /release_strix_dev skills
2026-03-17 07:23:04 +00:00

70 lines
1.5 KiB
Docker

# Strix - Smart IP Camera Stream Discovery System
# Multi-stage Dockerfile for minimal image size
# Stage 1: Builder
FROM golang:1.24-alpine AS builder
ARG VERSION=dev
WORKDIR /build
# Install build dependencies
RUN apk add --no-cache git
# Copy go mod files
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Build static binary
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build \
-ldflags="-s -w -X main.Version=${VERSION}" \
-o strix \
cmd/strix/main.go
# Stage 2: Runtime
FROM alpine:latest
# Install runtime dependencies
# - ffmpeg/ffprobe: Required for RTSP stream validation
# - ca-certificates: Required for HTTPS requests to cameras
# - tzdata: Required for correct timestamps
# - wget: Required for healthcheck
RUN apk add --no-cache \
ffmpeg \
ca-certificates \
tzdata \
wget \
&& rm -rf /var/cache/apk/*
WORKDIR /app
# Copy binary from builder
COPY --from=builder /build/strix .
# Copy camera database (CRITICAL - app won't work without it)
COPY --from=builder /build/data ./data
# Create directory for optional config
RUN mkdir -p /app/config
# Create non-root user for security
RUN addgroup -g 1000 strix && \
adduser -D -u 1000 -G strix strix && \
chown -R strix:strix /app
# Switch to non-root user
USER strix
# Expose default port
EXPOSE 4567
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:4567/api/v1/health || exit 1
# Start application
CMD ["./strix"]