mirror of
https://github.com/lukaszraczylo/gohoarder.git
synced 2026-06-05 22:53:53 +00:00
8a9d786b1a
- [x] Remove Docker compilation from server, scanner, migrate Dockerfiles - [x] Use pre-built binaries injected by GoReleaser instead - [x] Delete separate gateway container and merge into frontend - [x] Update .goreleaser.yaml to reference pre-built binaries - [x] Simplify Kubernetes deployment to remove gateway service - [x] Simplify docker-compose to remove gateway container - [x] Add backend proxy configuration to frontend
70 lines
2.2 KiB
Docker
70 lines
2.2 KiB
Docker
# Scanning Engine - Background Scanner Worker
|
|
# This Dockerfile expects a PRE-BUILT binary from GoReleaser (no compilation)
|
|
# GoReleaser injects the platform-specific binary automatically
|
|
|
|
FROM alpine:latest
|
|
|
|
# Install scanning tools and runtime dependencies (including CGO/SQLite dependencies)
|
|
RUN apk add --no-cache \
|
|
ca-certificates \
|
|
tzdata \
|
|
git \
|
|
curl \
|
|
wget \
|
|
bash \
|
|
sqlite-libs \
|
|
musl \
|
|
&& update-ca-certificates
|
|
|
|
# Install Trivy for container scanning
|
|
RUN curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin
|
|
|
|
# Install Grype for vulnerability scanning
|
|
RUN curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin
|
|
|
|
# Create non-root user
|
|
RUN addgroup -g 1000 scanner && \
|
|
adduser -D -u 1000 -G scanner scanner
|
|
|
|
# Create necessary directories with proper permissions
|
|
RUN mkdir -p /var/cache/gohoarder \
|
|
/var/lib/gohoarder/metadata \
|
|
/var/lib/trivy \
|
|
/tmp/gohoarder && \
|
|
chown -R scanner:scanner /var/cache/gohoarder \
|
|
/var/lib/gohoarder \
|
|
/var/lib/trivy \
|
|
/tmp/gohoarder && \
|
|
chmod -R 750 /var/cache/gohoarder \
|
|
/var/lib/gohoarder \
|
|
/var/lib/trivy
|
|
|
|
# Copy pre-built binary from GoReleaser
|
|
# GoReleaser will automatically inject the correct binary for the target platform
|
|
COPY gohoarder /usr/local/bin/gohoarder
|
|
RUN chmod +x /usr/local/bin/gohoarder
|
|
|
|
# Copy example config
|
|
COPY config.yaml.example /etc/gohoarder/config.yaml.example
|
|
|
|
WORKDIR /var/cache/gohoarder
|
|
USER scanner
|
|
|
|
# Expose metrics port
|
|
EXPOSE 9091
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=60s --timeout=30s --start-period=10s --retries=3 \
|
|
CMD ["/usr/local/bin/gohoarder", "version"] || exit 1
|
|
|
|
# Environment variables for scanner mode
|
|
ENV SCANNER_MODE=true \
|
|
SCANNER_WORKERS=4 \
|
|
SCANNER_INTERVAL=300
|
|
|
|
# Run the scanner in background mode
|
|
# The scanner runs the same serve command but uses SCANNER_MODE env var
|
|
# and configuration to determine its role
|
|
ENTRYPOINT ["/usr/local/bin/gohoarder"]
|
|
CMD ["serve"]
|