Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

ci: switch docker build-push secret input from secrets to secret-files

justin8021da9a28c6
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index 9dc4c695c..70ad21bca 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -60,6 +60,18 @@ jobs:
type=raw,value=${{ inputs.version }}
type=raw,value=latest,enable=${{ inputs.latest }}
+ # The web Dockerfile mounts SENTRY_AUTH_TOKEN from a BuildKit secret
+ # so it never lands in image metadata. This step writes the secret to a
+ # file that build-push-action exposes to the build at runtime.
+ - name: Prepare Sentry auth token for source-map upload
+ if: matrix.dockerfile == './apps/web/Dockerfile'
+ env:
+ SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
+ run: |
+ mkdir -p /tmp/sentry-build-secrets
+ printf '%s' "$SENTRY_AUTH_TOKEN" > /tmp/sentry-build-secrets/SENTRY_AUTH_TOKEN
+ chmod 600 /tmp/sentry-build-secrets/SENTRY_AUTH_TOKEN
+
- name: Build and push
uses: docker/build-push-action@v7
with:
@@ -71,6 +83,14 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
+ build-args: |
+ SENTRY_ORG=${{ vars.SENTRY_ORG }}
+ SENTRY_PROJECT=${{ vars.SENTRY_PROJECT }}
+ # secret-files mounts the file CONTENTS as the secret value in the
+ # build. The 'secrets:' input would pass the file path string as
+ # the value, which is not what BuildKit expects.
+ secret-files: |
+ SENTRY_AUTH_TOKEN=/tmp/sentry-build-secrets/SENTRY_AUTH_TOKEN
trigger-helm-publish:
needs: build-and-push-image
diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index c12541eec..7e0be3163 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -118,6 +118,18 @@ jobs:
type=raw,value=nightly-{{date 'YYYYMMDD'}}
type=sha,prefix=nightly-
+ # The web Dockerfile mounts SENTRY_AUTH_TOKEN from a BuildKit secret
+ # so it never lands in image metadata. This step writes the secret to a
+ # file that build-push-action exposes to the build at runtime.
+ - name: Prepare Sentry auth token for source-map upload
+ if: matrix.dockerfile == './apps/web/Dockerfile'
+ env:
+ SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
+ run: |
+ mkdir -p /tmp/sentry-build-secrets
+ printf '%s' "$SENTRY_AUTH_TOKEN" > /tmp/sentry-build-secrets/SENTRY_AUTH_TOKEN
+ chmod 600 /tmp/sentry-build-secrets/SENTRY_AUTH_TOKEN
+
- name: Build and push
uses: docker/build-push-action@v7
with:
@@ -129,3 +141,8 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
+ build-args: |
+ SENTRY_ORG=${{ vars.SENTRY_ORG }}
+ SENTRY_PROJECT=${{ vars.SENTRY_PROJECT }}
+ secrets: |
+ SENTRY_AUTH_TOKEN=/tmp/sentry-build-secrets/SENTRY_AUTH_TOKEN
diff --git a/.gitignore b/.gitignore
index c8c646dc7..68c523f73 100644
--- a/.gitignore
+++ b/.gitignore
@@ -54,3 +54,4 @@ compose.override.yml
# TanStack Router generated cache
apps/web/.tanstack/
+.pi/
diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile
index b06fb491d..88834e575 100644
--- a/apps/web/Dockerfile
+++ b/apps/web/Dockerfile
@@ -1,6 +1,15 @@
+# syntax=docker/dockerfile:1
# Build stage
FROM --platform=$BUILDPLATFORM node:20-alpine AS builder
+# Sentry org/project are public identifiers (not secrets). The auth token
+# is the only real secret; it is mounted via `--mount=type=secret` during
+# the pnpm build step so it never lands in any layer or image metadata.
+ARG SENTRY_ORG
+ARG SENTRY_PROJECT
+ENV SENTRY_ORG=$SENTRY_ORG
+ENV SENTRY_PROJECT=$SENTRY_PROJECT
+
# Install build dependencies in a single layer
RUN apk add --no-cache python3 make g++ && \
corepack enable && \
@@ -31,7 +40,9 @@ RUN pnpm run build
# Build the application
WORKDIR /app/apps/web
-RUN pnpm run build
+RUN --mount=type=secret,id=SENTRY_AUTH_TOKEN \
+ SENTRY_AUTH_TOKEN=$(cat /run/secrets/SENTRY_AUTH_TOKEN) \
+ pnpm run build
# Production stage with specific version
FROM nginx:1.29.5-alpine AS runtime