📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
Make dockerfile readable
Blue Mousec32ea299156c
diff --git a/backend/Dockerfile b/backend/Dockerfileindex 5816b9c2c..bf733cfb6 100644--- a/backend/Dockerfile+++ b/backend/Dockerfile@@ -1,39 +1,53 @@-#Stage 1+#Stage 1: BuildFROM node:lts-alpine as buildWORKDIR /build+COPY package*.json .+RUN npm install --forceCOPY . .-RUN npm i -g pnpm && pnpm i && npm run deploy:selfhosted+RUN npm run deploy:selfhostedRUN node ./meta/dbip-sync.js-#Stage 2+#Stage 2: RuntimeFROM node:lts-alpine as runLABEL maintainer="swetrix.com <[email protected]>"++# System and security configsENV TZ=UTC \+ NODE_ENV=production \JWT_ACCESS_TOKEN_SECRET=jwt-access-token-secret \- JWT_REFRESH_TOKEN_SECRET=jwt-refresh-token-secret \- REDIS_HOST=localhost \- REDIS_USER= \- REDIS_PASSWORD= \+ JWT_REFRESH_TOKEN_SECRET=jwt-refresh-token-secret++# Service connections+ENV REDIS_HOST=localhost \REDIS_PORT=6379 \CLICKHOUSE_HOST=http://localhost \CLICKHOUSE_USER=default \CLICKHOUSE_PORT=8123 \- CLICKHOUSE_PASSWORD= \- CLICKHOUSE_DATABASE=analytics \- API_ORIGINS=\+ CLICKHOUSE_DATABASE=analytics++# Application configs+ENV [email protected] \PASSWORD=12345678 \- API_KEY=\- DEBUG_MODE=\- IP_GEOLOCATION_DB_PATH=\IS_PRIMARY_NODE=true-RUN apk add --no-cache tzdata && cp /usr/share/zoneinfo/$TZ /etc/localtime++# Install and configure timezone+RUN apk add --no-cache tzdata && \+ cp /usr/share/zoneinfo/$TZ /etc/localtime && \+ apk del tzdata++# Use non-root numeric user+USER 999WORKDIR /app++# Copy files (updated to remove user:group ownership since we're not creating them)COPY --from=build /build/package*.json ./COPY --from=build /build/dist/ ./dist/COPY --from=build /build/dbip-city-lite.mmdb ./dbip-city-lite.mmdbCOPY --from=build /build/migrations ./migrationsCOPY --from=build /build/node_modules/ ./node_modules/-CMD [ "npm", "run", "start:prod" ]+EXPOSE 5005-HEALTHCHECK CMD wget -nv -t1 --spider 'http://localhost:5005/ping' || exit 1+HEALTHCHECK --interval=30s --timeout=5s \+ CMD wget -nv -t1 --spider 'http://localhost:5005/ping' || exit 1++CMD [ "npm", "run", "start:prod" ]