feat: process our source maps (#40213)

This commit is contained in:
Aleksander Błaszkiewicz
2025-10-23 18:41:37 +02:00
committed by GitHub
parent eedd51b7b1
commit b1aa0c1dba
3 changed files with 23 additions and 1 deletions

View File

@@ -66,3 +66,6 @@ rust/target
!docker-compose.base.yml
!docker-compose.dev.yml
!docker
!.git/config
!.git/HEAD
!.git/refs

View File

@@ -76,7 +76,11 @@ jobs:
push: true
tags: ghcr.io/posthog/posthog:latest,ghcr.io/posthog/posthog:${{ github.sha }},posthog/posthog:${{ github.sha }},posthog/posthog:latest,${{ steps.aws-ecr.outputs.registry }}/posthog-cloud:master,${{ steps.aws-ecr.outputs.registry }}/posthog-cloud:${{ github.sha }}
platforms: linux/arm64,linux/amd64
build-args: COMMIT_HASH=${{ github.sha }}
build-args: |
COMMIT_HASH=${{ github.sha }}
BUILDKIT_CONTEXT_KEEP_GIT_DIR=1
secrets: |
posthog_upload_sourcemaps_cli_api_key=${{ secrets.POSTHOG_UPLOAD_SOURCEMAPS_CLI_API_KEY }}
- name: report failure
if: failure()

View File

@@ -35,6 +35,9 @@ COPY common/esbuilder/ common/esbuilder/
COPY common/tailwind/ common/tailwind/
COPY products/ products/
COPY ee/frontend/ ee/frontend/
COPY .git/config .git/config
COPY .git/HEAD .git/HEAD
COPY .git/refs/heads .git/refs/heads
RUN --mount=type=cache,id=pnpm,target=/tmp/pnpm-store-v23 \
corepack enable && pnpm --version && \
pnpm --filter=@posthog/frontend... install --frozen-lockfile --store-dir /tmp/pnpm-store-v23
@@ -42,6 +45,18 @@ RUN --mount=type=cache,id=pnpm,target=/tmp/pnpm-store-v23 \
COPY frontend/ frontend/
RUN bin/turbo --filter=@posthog/frontend build
# Process sourcemaps using posthog-cli
RUN --mount=type=secret,id=posthog_upload_sourcemaps_cli_api_key \
if [ -f /run/secrets/posthog_upload_sourccemaps_cli_api_key ]; then \
apt-get update && \
apt-get install -y --no-install-recommends ca-certificates curl && \
curl --proto '=https' --tlsv1.2 -LsSf https://download.posthog.com/cli | sh && \
export PATH="/root/.posthog:$PATH" && \
export POSTHOG_CLI_TOKEN="$(cat /run/secrets/posthog_upload_sourcemaps_cli_api_key)" && \
export POSTHOG_CLI_ENV_ID=2 && \
posthog-cli sourcemap process --directory /code/frontend/dist --public-path-prefix /static --no-fail; \
fi
#
# ---------------------------------------------------------
#