Dockerfile-frontend
Rama master · réplica de lectura del repositorio original.
# node:26-trixie-slim -- Node.js 26 (LTS) on Debian trixie-slim.
# Multi-arch manifest list digest, resolved 2026-10-27.
FROM node:26-trixie-slim@sha256:36793bcbb160a6a16cede1e62b93f84e26b78a972a8a4c0b879c1c12f22761ec AS builder
ARG COUNTLY_PLUGINS=mobile,web,desktop,plugins,density,locale,browser,sources,views,logger,systemlogs,populator,reports,crashes,push,star-rating,slipping-away-users,compare,server-stats,dbviewer,times-of-day,compliance-hub,alerts,onboarding,consolidate,remote-config,hooks,dashboards,sdk,data-manager,guides
# Countly Enterprise:
#ARG COUNTLY_PLUGINS=mobile,web,desktop,plugins,density,locale,browser,sources,views,license,drill,funnels,retention_segments,flows,cohorts,surveys,remote-config,ab-testing,formulas,activity-map,concurrent_users,revenue,logger,systemlogs,populator,reports,crashes,push,geo,block,users,star-rating,slipping-away-users,compare,server-stats,dbviewer,crash_symbolication,crashes-jira,groups,white-labeling,alerts,times-of-day,compliance-hub,onboarding,active_users,performance-monitoring,config-transfer,consolidate,data-manager,hooks,dashboards,heatmaps,sdk,guides,journey_engine,content
ENV COUNTLY_CONTAINER="frontend" \
COUNTLY_DEFAULT_PLUGINS="${COUNTLY_PLUGINS}" \
NODE_OPTIONS="--max-old-space-size=2048 --no-node-snapshot" \
npm_config_allow_git=root \
npm_config_dangerously_allow_all_scripts=true \
PUPPETEER_SKIP_DOWNLOAD=true
# Build dependencies live only in this stage and are never shipped
RUN apt-get update && \
apt-get install -y curl wget git make gcc g++ unzip xz-utils build-essential sudo \
python3 python3-setuptools ca-certificates
WORKDIR /opt/countly
COPY . .
# Frontend never runs models; the marker makes ab-testing's setup.sh a no-op
RUN { [ ! -d plugins/ab-testing/api/bayesian ] || touch plugins/ab-testing/api/bayesian/.ab_disabled; } && \
./bin/docker/modify.sh && \
cp -n ./api/config.sample.js ./api/config.js && \
cp -n ./frontend/express/config.sample.js ./frontend/express/config.js && \
cp -n ./frontend/express/public/javascripts/countly/countly.config.sample.js ./frontend/express/public/javascripts/countly/countly.config.js && \
HOME=/tmp npm install -g npm@11.19.0 && \
HOME=/tmp npm install && \
HOME=/tmp npm_config_build_from_source=true npm install argon2 && \
./bin/docker/preinstall.sh && \
bash /opt/countly/bin/scripts/detect.init.sh && \
countly update sdk-web && \
npm remove -y --no-save mocha should supertest puppeteer && \
# CE builds carry only a stub ab-testing dir; drop it so it never ships
{ [ -f plugins/ab-testing/package.json ] || rm -rf plugins/ab-testing; } && \
rm -rf test /tmp/* /var/tmp/* /root/.npm && \
chown -R 1001:0 /opt/countly && \
chmod -R g=u /opt/countly
FROM node:26-trixie-slim@sha256:36793bcbb160a6a16cede1e62b93f84e26b78a972a8a4c0b879c1c12f22761ec AS runtime
ARG COUNTLY_PLUGINS=mobile,web,desktop,plugins,density,locale,browser,sources,views,logger,systemlogs,populator,reports,crashes,push,star-rating,slipping-away-users,compare,server-stats,dbviewer,times-of-day,compliance-hub,alerts,onboarding,consolidate,remote-config,hooks,dashboards,sdk,data-manager,guides
EXPOSE 6001
HEALTHCHECK --start-period=400s CMD bash -c '\
if [ "$COUNTLY_CONFIG_FRONTEND_WEB_SSL_ENABLED" = "true" ] || [ "$COUNTLY_CONFIG_FRONTEND_WEB_SSL_ENABLED" = "\"true\"" ]; then \
curl -k --fail https://localhost:6001/ping || exit 1; \
else \
curl --fail http://localhost:6001/ping || exit 1; \
fi'
ENV COUNTLY_CONTAINER="frontend" \
COUNTLY_DEFAULT_PLUGINS="${COUNTLY_PLUGINS}" \
COUNTLY_CONFIG_FRONTEND_WEB_HOST="0.0.0.0" \
NODE_OPTIONS="--max-old-space-size=2048 --no-node-snapshot" \
HOME=/tmp
# Runtime-only packages: init, healthcheck, ops tools
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
tini curl procps iputils-ping net-tools ca-certificates \
sudo telnet xz-utils apt-transport-https lsb-release && \
apt-get clean && rm -rf /var/lib/apt/lists/* && \
echo "Etc/UTC" > /etc/timezone
WORKDIR /opt/countly
COPY --from=builder /usr/local /usr/local
COPY --from=builder /opt/countly /opt/countly
# npm stays for in-container plugin rebuilds (countly task dist-all -> npx grunt)
RUN ln -sf /opt/countly/bin/commands/countly.sh /usr/bin/countly && \
chown 1001:0 /opt/countly && chmod g=u /opt/countly && \
mkdir -p /.npm && chown -R 1001:0 /.npm && chmod -R g=u /.npm
USER 1001:0
ENTRYPOINT ["/usr/bin/tini", "-v", "--"]
CMD ["/opt/countly/bin/docker/cmd.sh"]