From 49ffa07af3b764dd7eb3a16412ce78bfe9249679 Mon Sep 17 00:00:00 2001 From: Pihkaal Date: Fri, 27 Feb 2026 19:40:15 +0100 Subject: [PATCH] feat(umami): setup --- .gitea/workflows/docker-build.yml | 10 +++++++++- Dockerfile | 27 ++++++++++++++++----------- nuxt.config.ts | 8 +++++++- package.json | 1 + pnpm-lock.yaml | 18 ++++++++++++++++++ 5 files changed, 51 insertions(+), 13 deletions(-) diff --git a/.gitea/workflows/docker-build.yml b/.gitea/workflows/docker-build.yml index ff59fc1..c2c243c 100644 --- a/.gitea/workflows/docker-build.yml +++ b/.gitea/workflows/docker-build.yml @@ -23,7 +23,15 @@ jobs: username: ${{ secrets.REGISTRY_USERNAME }} password: ${{ secrets.REGISTRY_PASSWORD }} + - name: Debug secrets + run: | + echo "UMAMI_HOST (first 10): $(echo '${{ secrets.UMAMI_HOST }}' | cut -c1-10)" + echo "UMAMI_ID (first 8): $(echo '${{ secrets.UMAMI_ID }}' | cut -c1-8)" + - name: Build and push Docker image run: | - docker build -t git.pihkaal.me/pihkaal/simple-qr:latest . + docker build \ + --build-arg UMAMI_HOST=${{ secrets.UMAMI_HOST }} \ + --build-arg UMAMI_ID=${{ secrets.UMAMI_ID }} \ + -t git.pihkaal.me/pihkaal/simple-qr:latest . docker push git.pihkaal.me/pihkaal/simple-qr:latest diff --git a/Dockerfile b/Dockerfile index 85bf2cc..e5e0426 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,29 @@ FROM node:20-slim AS base - -ENV PNPM_HOME="/pnpm" -ENV PATH="$PNPM_HOME:$PATH" - RUN corepack enable -COPY . /app +FROM base AS deps WORKDIR /app +COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ +RUN pnpm install --frozen-lockfile FROM base AS prod-deps -RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile --ignore-scripts +WORKDIR /app +COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ +RUN pnpm install --prod --frozen-lockfile --ignore-scripts FROM base AS build -RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile +WORKDIR /app +COPY --from=deps /app/node_modules ./node_modules +COPY . . +ARG UMAMI_HOST +ARG UMAMI_ID +ENV UMAMI_HOST=$UMAMI_HOST +ENV UMAMI_ID=$UMAMI_ID RUN pnpm run build FROM base - -COPY --from=prod-deps /app/node_modules /app/node_modules -COPY --from=build /app/.output /app/.output - +WORKDIR /app +COPY --from=prod-deps /app/node_modules ./node_modules +COPY --from=build /app/.output ./.output EXPOSE 3000 CMD ["node", ".output/server/index.mjs"] diff --git a/nuxt.config.ts b/nuxt.config.ts index 9934388..a2fcc42 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -2,7 +2,7 @@ export default defineNuxtConfig({ compatibilityDate: "2024-11-01", devtools: { enabled: true }, - modules: ["@nuxt/eslint", "@nuxt/ui", "@nuxt/image"], + modules: ["@nuxt/eslint", "@nuxt/ui", "@nuxt/image", "nuxt-umami"], css: ["~/assets/css/main.css"], components: [ { @@ -10,4 +10,10 @@ export default defineNuxtConfig({ pathPrefix: false, }, ], + umami: { + host: process.env.UMAMI_HOST ?? "", + id: process.env.UMAMI_ID ?? "", + autoTrack: true, + ignoreLocalhost: true, + }, }); diff --git a/package.json b/package.json index fe08471..7f6873b 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "@types/qrcode": "^1.5.6", "eslint": "^9.39.1", "nuxt": "^4.3.1", + "nuxt-umami": "3.2.1", "prettier": "^3.8.1", "tailwindcss": "^4.2.0", "typescript": "^5.6.3" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9cd8d94..e366b41 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -51,6 +51,9 @@ importers: nuxt: specifier: ^4.3.1 version: 4.3.1(@parcel/watcher@2.4.1)(@vue/compiler-sfc@3.5.28)(cac@6.7.14)(db0@0.3.4)(eslint@9.39.3(jiti@2.6.1))(ioredis@5.9.3)(lightningcss@1.31.1)(magicast@0.5.2)(optionator@0.9.4)(rollup@4.57.1)(terser@5.34.1)(typescript@5.9.3)(vite@7.3.1(jiti@2.6.1)(lightningcss@1.31.1)(terser@5.34.1)(yaml@2.8.2))(yaml@2.8.2) + nuxt-umami: + specifier: 3.2.1 + version: 3.2.1(magicast@0.5.2) prettier: specifier: ^3.8.1 version: 3.8.1 @@ -3791,6 +3794,9 @@ packages: nth-check@2.1.1: resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==} + nuxt-umami@3.2.1: + resolution: {integrity: sha512-82cf3kcrMn4Iq0rJ2Blfl48AqLWqRubEpxOinOoxqW7taZAd5SgZcCdCj7y4qXSt0W5DhBYgaq4IboyGFHoVUQ==} + nuxt@4.3.1: resolution: {integrity: sha512-bl+0rFcT5Ax16aiWFBFPyWcsTob19NTZaDL5P6t0MQdK63AtgS6fN6fwvwdbXtnTk6/YdCzlmuLzXhSM22h0OA==} engines: {node: ^20.19.0 || >=22.12.0} @@ -4256,6 +4262,9 @@ packages: peerDependencies: vue: '>= 3.2.0' + request-ip@3.3.0: + resolution: {integrity: sha512-cA6Xh6e0fDBBBwH77SLJaJPBmD3nWVAcF9/XAcsrIHdjhFzFiB5aNQFytdjCGPezU3ROwrR11IddKAM08vohxA==} + require-directory@2.1.1: resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} engines: {node: '>=0.10.0'} @@ -8997,6 +9006,13 @@ snapshots: dependencies: boolbase: 1.0.0 + nuxt-umami@3.2.1(magicast@0.5.2): + dependencies: + '@nuxt/kit': 3.21.1(magicast@0.5.2) + request-ip: 3.3.0 + transitivePeerDependencies: + - magicast + nuxt@4.3.1(@parcel/watcher@2.4.1)(@vue/compiler-sfc@3.5.28)(cac@6.7.14)(db0@0.3.4)(eslint@9.39.3(jiti@2.6.1))(ioredis@5.9.3)(lightningcss@1.31.1)(magicast@0.5.2)(optionator@0.9.4)(rollup@4.57.1)(terser@5.34.1)(typescript@5.9.3)(vite@7.3.1(jiti@2.6.1)(lightningcss@1.31.1)(terser@5.34.1)(yaml@2.8.2))(yaml@2.8.2): dependencies: '@dxup/nuxt': 0.3.2(magicast@0.5.2) @@ -9608,6 +9624,8 @@ snapshots: - '@vue/composition-api' - typescript + request-ip@3.3.0: {} + require-directory@2.1.1: {} require-main-filename@2.0.0: {}