35 lines
1.1 KiB
Docker
35 lines
1.1 KiB
Docker
# Collector server image. Installs the published @logger/collector from the
|
|
# private Verdaccio registry and runs its `logging-collector` server entry.
|
|
#
|
|
# docker build \
|
|
# --build-arg REGISTRY=http://host.docker.internal:4873 \
|
|
# -t logger-collector:0.1.0 .
|
|
#
|
|
# docker run -d -p 4319:4319 -v logger-collector-data:/data logger-collector:0.1.0
|
|
#
|
|
# Verdaccio allows anonymous reads, so no auth token is needed to install.
|
|
FROM node:22-alpine
|
|
|
|
ARG REGISTRY=http://host.docker.internal:4873
|
|
ARG COLLECTOR_VERSION=0.1.0
|
|
|
|
WORKDIR /app
|
|
|
|
RUN npm config set registry "${REGISTRY}" \
|
|
&& npm install --omit=dev --no-save --no-package-lock "@logger/collector@${COLLECTOR_VERSION}" \
|
|
&& npm cache clean --force
|
|
|
|
ENV NODE_ENV=production \
|
|
HOST=0.0.0.0 \
|
|
PORT=4319 \
|
|
LOG_FILE=/data/logs.jsonl
|
|
|
|
VOLUME ["/data"]
|
|
EXPOSE 4319
|
|
|
|
# Liveness probe: the read-only /query endpoint must answer 200.
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=3s --retries=3 \
|
|
CMD wget -q -O /dev/null "http://127.0.0.1:${PORT}/query?limit=1" || exit 1
|
|
|
|
CMD ["node", "/app/node_modules/@logger/collector/dist/server.js"]
|