mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-04-10 23:25:41 +00:00
## Summary Implements the `DISABLE_CADDY` environment variable in the Docker entrypoint, fixing #629. ## Problem The `DISABLE_CADDY` env var was documented but had no effect — the entrypoint only handled `DISABLE_MOSQUITTO`. ## Changes ### New supervisord configs - **`supervisord-go-no-caddy.conf`** — mosquitto + ingestor + server (no Caddy) - **`supervisord-go-no-mosquitto-no-caddy.conf`** — ingestor + server only ### Updated entrypoint (`docker/entrypoint-go.sh`) Handles all 4 combinations: | DISABLE_MOSQUITTO | DISABLE_CADDY | Config used | |---|---|---| | false | false | `supervisord.conf` (default) | | true | false | `supervisord-no-mosquitto.conf` | | false | true | `supervisord-no-caddy.conf` | | true | true | `supervisord-no-mosquitto-no-caddy.conf` | ### Dockerfiles Added COPY lines for the new configs in both `Dockerfile` and `Dockerfile.go`. ## Testing ```bash # Verify correct config selection docker run -e DISABLE_CADDY=true corescope # Should log: [config] Caddy reverse proxy disabled (DISABLE_CADDY=true) docker run -e DISABLE_CADDY=true -e DISABLE_MOSQUITTO=true corescope # Should log both disabled messages ``` Fixes #629 Co-authored-by: you <you@example.com>
63 lines
1.8 KiB
Docker
63 lines
1.8 KiB
Docker
FROM golang:1.22-alpine AS builder
|
|
|
|
RUN apk add --no-cache build-base
|
|
|
|
ARG APP_VERSION=unknown
|
|
ARG GIT_COMMIT=unknown
|
|
ARG BUILD_TIME=unknown
|
|
|
|
# Build server
|
|
WORKDIR /build/server
|
|
COPY cmd/server/go.mod cmd/server/go.sum ./
|
|
COPY internal/geofilter/ ../../internal/geofilter/
|
|
RUN go mod download
|
|
COPY cmd/server/ ./
|
|
RUN go build -ldflags "-X main.Version=${APP_VERSION} -X main.Commit=${GIT_COMMIT} -X main.BuildTime=${BUILD_TIME}" -o /corescope-server .
|
|
|
|
# Build ingestor
|
|
WORKDIR /build/ingestor
|
|
COPY cmd/ingestor/go.mod cmd/ingestor/go.sum ./
|
|
RUN go mod download
|
|
COPY cmd/ingestor/ ./
|
|
RUN go build -o /corescope-ingestor .
|
|
|
|
# Runtime image
|
|
FROM alpine:3.20
|
|
|
|
RUN apk add --no-cache mosquitto mosquitto-clients supervisor caddy wget
|
|
|
|
WORKDIR /app
|
|
|
|
# Go binaries
|
|
COPY --from=builder /corescope-server /corescope-ingestor /app/
|
|
|
|
# Frontend assets + config
|
|
COPY public/ ./public/
|
|
COPY config.example.json channel-rainbow.json ./
|
|
|
|
# Bake git commit SHA — manage.sh and CI write .git-commit before build
|
|
# Default to "unknown" if not provided
|
|
RUN echo "unknown" > .git-commit
|
|
|
|
# Supervisor + Mosquitto + Caddy config
|
|
COPY docker/supervisord-go.conf /etc/supervisor/conf.d/supervisord.conf
|
|
COPY docker/supervisord-go-no-mosquitto.conf /etc/supervisor/conf.d/supervisord-no-mosquitto.conf
|
|
COPY docker/supervisord-go-no-caddy.conf /etc/supervisor/conf.d/supervisord-no-caddy.conf
|
|
COPY docker/supervisord-go-no-mosquitto-no-caddy.conf /etc/supervisor/conf.d/supervisord-no-mosquitto-no-caddy.conf
|
|
COPY docker/mosquitto.conf /etc/mosquitto/mosquitto.conf
|
|
COPY docker/Caddyfile /etc/caddy/Caddyfile
|
|
|
|
# Data directory
|
|
RUN mkdir -p /app/data /var/lib/mosquitto /data/caddy && \
|
|
chown -R mosquitto:mosquitto /var/lib/mosquitto
|
|
|
|
# Entrypoint
|
|
COPY docker/entrypoint-go.sh /entrypoint.sh
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
EXPOSE 80 443 1883
|
|
|
|
VOLUME ["/app/data", "/data/caddy"]
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|