mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-03-30 18:15:47 +00:00
Node.js: reads version from package.json, commit from .git-commit file or git rev-parse --short HEAD at runtime, with unknown fallback. Go: uses -ldflags build-time variables (Version, Commit) with fallback to .git-commit file and git command at runtime. Dockerfile: copies .git-commit if present (CI bakes it before build). Dockerfile.go: passes APP_VERSION and GIT_COMMIT as build args to ldflags. deploy.yml: writes GITHUB_SHA to .git-commit before docker build steps. docker-compose.yml: passes build args to Go staging build. Tests updated to verify version and commit fields in both endpoints. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
38 lines
1.1 KiB
Docker
38 lines
1.1 KiB
Docker
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"]
|