diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index cdaa8444..761584b3 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -172,9 +172,8 @@ jobs: - name: Enforce gofmt + go vet (issue #1859) run: | set -e - # gofmt: every tracked *.go file except the misnamed Dockerfile.go, - # which is a Dockerfile (FROM ...) that gofmt cannot parse. - unformatted=$(gofmt -l $(git ls-files '*.go' | grep -vi 'Dockerfile.go')) + # gofmt: every tracked *.go file. + unformatted=$(gofmt -l $(git ls-files '*.go')) if [ -n "$unformatted" ]; then echo "::error::gofmt required on these files:" echo "$unformatted" diff --git a/Dockerfile.go b/Dockerfile.go deleted file mode 100644 index ec2725f5..00000000 --- a/Dockerfile.go +++ /dev/null @@ -1,61 +0,0 @@ -FROM golang:1.27-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 ./ -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 (CI writes .git-commit before build; fallback for non-ldflags usage) -COPY .git-commi[t] ./ -RUN if [ ! -f .git-commit ]; then echo "unknown" > .git-commit; fi - -# 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"] diff --git a/Dockerfile.node b/Dockerfile.node deleted file mode 100644 index f6244072..00000000 --- a/Dockerfile.node +++ /dev/null @@ -1,37 +0,0 @@ -FROM node:22-alpine - -RUN apk add --no-cache mosquitto mosquitto-clients supervisor caddy - -WORKDIR /app - -# Install Node dependencies -COPY package.json package-lock.json ./ -RUN npm ci --production - -# Copy application -COPY *.js config.example.json channel-rainbow.json ./ -COPY public/ ./public/ - -# Bake git commit SHA (CI writes .git-commit before build; fallback to "unknown") -COPY .git-commi[t] ./ -RUN if [ ! -f .git-commit ]; then echo "unknown" > .git-commit; fi - -# Supervisor + Mosquitto + Caddy config -COPY docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf -COPY docker/mosquitto.conf /etc/mosquitto/mosquitto.conf -COPY docker/Caddyfile /etc/caddy/Caddyfile - -# Create data directory for SQLite + Mosquitto persistence + Caddy certs -RUN mkdir -p /app/data /var/lib/mosquitto /data/caddy && \ - chown -R node:node /app/data && \ - chown -R mosquitto:mosquitto /var/lib/mosquitto - -# Default config: copy example if no config mounted -COPY docker/entrypoint.sh /entrypoint.sh -RUN chmod +x /entrypoint.sh - -EXPOSE 80 443 1883 - -VOLUME ["/app/data", "/data/caddy"] - -ENTRYPOINT ["/entrypoint.sh"] diff --git a/Makefile b/Makefile index 34f71ccd..345d628f 100644 --- a/Makefile +++ b/Makefile @@ -109,7 +109,7 @@ vet: bash scripts/allmod.sh vet ./... fmt-check: - @unformatted=$$(gofmt -l $$(git ls-files '*.go' | grep -vi 'Dockerfile.go')); \ + @unformatted=$$(gofmt -l $$(git ls-files '*.go')); \ if [ -n "$$unformatted" ]; then echo "gofmt required on:"; echo "$$unformatted"; exit 1; fi; \ echo "gofmt: clean" diff --git a/docs/go-migration.md b/docs/go-migration.md index cf6b439e..90cf991d 100644 --- a/docs/go-migration.md +++ b/docs/go-migration.md @@ -1,4 +1,10 @@ -# Migrating from Node.js to Go Engine +# Migrating from Node.js to Go Engine (Historical) + +> **Historical guide — July 2025.** These instructions describe the retired +> Node.js-to-Go migration, including obsolete build recipes and Node.js rollback. +> `Dockerfile.go` and `Dockerfile.node` have been removed. For current installation +> and upgrades, follow [Deploy CoreScope](../DEPLOY.md); source builds use the +> canonical [`Dockerfile`](../Dockerfile). Guide for existing CoreScope users switching from the Node.js Docker image to the Go version.