mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-14 21:10:34 +01:00
Added update-tracker script. Updated docker build.
This commit is contained in:
parent
bc75b622b5
commit
6cfe910ba9
@ -12,15 +12,11 @@ WORKDIR /app
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
|
||||
ARG DATABASE_URL
|
||||
ARG DATABASE_TYPE
|
||||
ARG BASE_PATH
|
||||
ARG DISABLE_LOGIN
|
||||
|
||||
ENV DATABASE_URL $DATABASE_URL
|
||||
ENV DATABASE_TYPE $DATABASE_TYPE
|
||||
ENV BASE_PATH $BASE_PATH
|
||||
ENV DISABLE_LOGIN $DISABLE_LOGIN
|
||||
|
||||
ENV NEXT_TELEMETRY_DISABLED 1
|
||||
|
||||
@ -36,8 +32,7 @@ ENV NEXT_TELEMETRY_DISABLED 1
|
||||
RUN addgroup --system --gid 1001 nodejs
|
||||
RUN adduser --system --uid 1001 nextjs
|
||||
|
||||
RUN yarn global add prisma
|
||||
RUN yarn add npm-run-all dotenv
|
||||
RUN yarn add npm-run-all dotenv prisma
|
||||
|
||||
# You only need to copy next.config.js if you are NOT using the default configuration
|
||||
COPY --from=builder /app/next.config.js .
|
||||
|
@ -13,7 +13,7 @@
|
||||
"dev": "next dev",
|
||||
"build": "npm-run-all build-tracker build-geo build-db build-app",
|
||||
"start": "npm-run-all check-db start-next",
|
||||
"start-docker": "npm-run-all check-db build-tracker start-server",
|
||||
"start-docker": "npm-run-all check-db update-tracker start-server",
|
||||
"start-env": "node scripts/start-env.js",
|
||||
"start-server": "node server.js",
|
||||
"start-next": "next start",
|
||||
@ -24,6 +24,7 @@
|
||||
"build-geo": "node scripts/build-geo.js",
|
||||
"build-db-schema": "prisma db pull",
|
||||
"build-db-client": "prisma generate",
|
||||
"update-tracker": "node scripts/update-tracker.js",
|
||||
"update-db": "prisma migrate deploy",
|
||||
"check-db": "node scripts/check-db.js",
|
||||
"copy-db-files": "node scripts/copy-db-files.js",
|
||||
|
18
scripts/update-tracker.js
Normal file
18
scripts/update-tracker.js
Normal file
@ -0,0 +1,18 @@
|
||||
require('dotenv').config();
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const endPoint = process.env.COLLECT_API_ENDPOINT;
|
||||
|
||||
if (endPoint) {
|
||||
const file = path.resolve(__dirname, '../public/umami.js');
|
||||
|
||||
const tracker = fs.readFileSync(file);
|
||||
|
||||
fs.writeFileSync(
|
||||
path.resolve(file),
|
||||
tracker.toString().replace(/"\/api\/collect"/g, `"${endPoint}"`),
|
||||
);
|
||||
|
||||
console.log(`Updated tracker endpoint with "${endPoint}"`);
|
||||
}
|
Loading…
Reference in New Issue
Block a user