Skip to content

Commit f98d985

Browse files
fix: build private-chat with posthog config
1 parent 4155642 commit f98d985

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
- fix/posthog-build-args
78
tags:
89
- 'v*'
910

Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ RUN curl -L -o /tmp/private-chat.tar.gz "https://github.com/nearai/private-chat/
4242
tar -xzf /tmp/private-chat.tar.gz --strip-components=1 && \
4343
rm /tmp/private-chat.tar.gz
4444

45+
# Set the PostHog key and host
46+
ARG POSTHOG_KEY
47+
ARG POSTHOG_HOST
48+
ENV VITE_PUBLIC_POSTHOG_KEY=${POSTHOG_KEY}
49+
ENV VITE_PUBLIC_POSTHOG_HOST=${POSTHOG_HOST}
50+
4551
# Install pnpm with specific version
4652
RUN npm install -g pnpm@10.10.0
4753

build-config.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@
88
# - "v1.2.3" (tag)
99
# - "abc123def456" (commit hash)
1010
private_chat_frontend_version = "9bc941ab98b6d6ffcb60c4aefdaf9d66ceb664c7"
11+
12+
# PostHog key and host for the private-chat frontend
13+
posthog_key = "phc_glaMeuuO1gLFSB2U9y27MchidXEmSnFOQLB8cceyVSb"
14+
posthog_host = "https://us.i.posthog.com"

scripts/build-image.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,22 @@ git rev-parse HEAD > .GIT_REV
3333
# Read private-chat frontend version from build-config.toml
3434
if [ -f "build-config.toml" ]; then
3535
PRIVATE_CHAT_FRONTEND_VERSION=$(grep -E '^\s*private_chat_frontend_version\s*=' build-config.toml | awk -F'"' '{print $2}' | head -n1)
36+
POSTHOG_KEY=$(grep -E '^\s*posthog_key\s*=' build-config.toml | awk -F'"' '{print $2}' | head -n1)
37+
POSTHOG_HOST=$(grep -E '^\s*posthog_host\s*=' build-config.toml | awk -F'"' '{print $2}' | head -n1)
3638
fi
3739
if [ -z "$PRIVATE_CHAT_FRONTEND_VERSION" ]; then
3840
echo "Error: private-chat frontend version not found in build-config.toml"
3941
exit 1
4042
fi
4143
echo "Using private-chat frontend version: ${PRIVATE_CHAT_FRONTEND_VERSION}"
44+
echo "Using PostHog key: ${POSTHOG_KEY} and host: ${POSTHOG_HOST}"
4245

4346
TEMP_TAG="private-chat-temp:$(date +%s)"
4447
docker buildx build --builder buildkit_20 --no-cache --platform linux/amd64 \
4548
--build-arg SOURCE_DATE_EPOCH="0" \
4649
--build-arg PRIVATE_CHAT_FRONTEND_VERSION="${PRIVATE_CHAT_FRONTEND_VERSION}" \
50+
--build-arg POSTHOG_KEY="${POSTHOG_KEY}" \
51+
--build-arg POSTHOG_HOST="${POSTHOG_HOST}" \
4752
--output type=oci,dest=./oci.tar,rewrite-timestamp=true \
4853
--output type=docker,name="$TEMP_TAG",rewrite-timestamp=true .
4954

0 commit comments

Comments
 (0)