📈 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
added support for docker env vars
Blue Mouse3682e2267431
diff --git a/Dockerfile b/Dockerfileindex fbedcce2f..dd5969bbe 100644--- a/Dockerfile+++ b/Dockerfile@@ -1,22 +1,32 @@# Stage 1FROM node:lts-alpine as build-ARG API_URL+ARG API_URL="https://full.master/api"ENV TZ=Etc/UTC \- REACT_APP_API_URL=${API_URL} \REACT_APP_SELFHOSTED=true \CHOKIDAR_USEPOLLING=true \- GENERATE_SOURCEMAP=false+ GENERATE_SOURCEMAP=false \+ JQ_VERSION=1.6+RUN wget --no-check-certificate https://github.com/stedolan/jq/releases/download/jq-${JQ_VERSION}/jq-linux64 -O /tmp/jq-linux64+RUN cp /tmp/jq-linux64 /usr/bin/jq+RUN chmod +x /usr/bin/jqRUN apk add --no-cache tzdata && cp /usr/share/zoneinfo/$TZ /etc/localtimeWORKDIR /appCOPY . .+RUN jq 'to_entries | map_values({ (.key) : ("$" + .key) }) | reduce .[] as $item ({}; . + $item)' ./src/config.json > ./src/config.tmp.json && mv ./src/config.tmp.json ./src/config.jsonRUN npm install -g pnpm && pnpm install && npm run build# Stage 2FROM nginx:stable-alpineENV TZ=Etc/UTC+ENV JSFOLDER=/usr/share/nginx/html/static/js/*.jsRUN rm -rf /usr/share/nginx/html/*RUN apk add --no-cache tzdata && cp /usr/share/zoneinfo/$TZ /etc/localtimeCOPY --from=build /app/deployment/default.conf /etc/nginx/conf.d/default.confCOPY --from=build /app/build /usr/share/nginx/html+COPY --from=build /app/start-nginx.sh /usr/bin/start-nginx.sh+RUN chmod +x /usr/bin/start-nginx.sh+WORKDIR /usr/share/nginx/html+COPY --from=build /app/build .+ENTRYPOINT [ "sh", "/usr/bin/start-nginx.sh" ]EXPOSE 80-HEALTHCHECK CMD curl -f http://localhost/ || exit 1\ No newline at end of file+HEALTHCHECK CMD curl -f http://localhost/ || exit 1diff --git a/deployment/default.conf b/deployment/default.confindex 018a091af..369088220 100644--- a/deployment/default.conf+++ b/deployment/default.conf@@ -1,17 +1,17 @@server {- listen 80- add_header Cross-Origin-Embedder-Policy "require-corp; report-to='default'"- add_header Cross-Origin-Opener-Policy "same-site; report-to='default'"- add_header Cross-Origin-Resource-Policy "same-site"- add_header Permissions-Policy "interest-cohort=()"- add_header Referrer-Policy "strict-origin-when-cross-origin"- add_header X-Frame-Options "DENY"- add_header X-Powered-By "Mountain Dew"- add_header X-XSS-Protection "0; mode=block"+ listen 80;+ add_header Cross-Origin-Embedder-Policy "require-corp; report-to='default'";+ add_header Cross-Origin-Opener-Policy "same-site; report-to='default'";+ add_header Cross-Origin-Resource-Policy "same-site";+ add_header Permissions-Policy "interest-cohort=()";+ add_header Referrer-Policy "strict-origin-when-cross-origin";+ add_header X-Frame-Options "DENY";+ add_header X-Powered-By "Mountain Dew";+ add_header X-XSS-Protection "0; mode=block";location / {- root /usr/share/nginx/html- index index.html index.htm- try_files $uri $uri/ /index.html =404+ root /usr/share/nginx/html;+ index index.html index.htm;+ try_files $uri $uri/ /index.html =404;}}diff --git a/src/config.json b/src/config.jsonnew file mode 100644index 000000000..ea22a011c--- /dev/null+++ b/src/config.json@@ -0,0 +1,3 @@+{+ "API_URL": "$API_URL"+}\ No newline at end of filediff --git a/start-ngnix.sh b/start-nginx.shsimilarity index 62%rename from start-ngnix.shrename to start-nginx.shindex 0e9c79097..e6682cee3 100644--- a/start-ngnix.sh+++ b/start-nginx.sh@@ -1,7 +1,7 @@-#!/usr/bin/env bash+#!/usr/bin/env shexport EXISTING_VARS=$(printenv | awk -F= '{print $1}' | sed 's/^/\$/g' | paste -sd,);for file in $JSFOLDER;do- cat $file | envsubst $EXISTING_VARS | tee $file+ cat $file | envsubst $EXISTING_VARS | tee $file > /dev/null 2>&1donenginx -g 'daemon off;'