|
1 | 1 | # ------ Global scope variables ------ |
| 2 | + |
2 | 3 | # Set of global build arguments. |
| 4 | +# These are considered "public" and will be baked into the image. |
| 5 | +# The convention is to prefix these with `NEXT_PUBLIC_` so that |
| 6 | +# they can be optionally be passed as client-side environment variables |
| 7 | +# in the webapp. |
3 | 8 | # @see: https://docs.docker.com/build/building/variables/#scoping |
4 | 9 |
|
5 | | -ARG SOURCEBOT_VERSION |
| 10 | +ARG NEXT_PUBLIC_SOURCEBOT_VERSION |
6 | 11 | # PAPIK = Project API Key |
7 | 12 | # Note that this key does not need to be kept secret, so it's not |
8 | 13 | # necessary to use Docker build secrets here. |
9 | 14 | # @see: https://posthog.com/tutorials/api-capture-events#authenticating-with-the-project-api-key |
10 | | -ARG POSTHOG_PAPIK |
11 | | -ARG SENTRY_ENVIRONMENT |
12 | | -ARG SOURCEBOT_CLOUD_ENVIRONMENT |
| 15 | +ARG NEXT_PUBLIC_POSTHOG_PAPIK |
| 16 | +ARG NEXT_PUBLIC_SENTRY_ENVIRONMENT |
| 17 | +ARG NEXT_PUBLIC_SOURCEBOT_CLOUD_ENVIRONMENT |
| 18 | +ARG NEXT_PUBLIC_SENTRY_WEBAPP_DSN |
| 19 | +ARG NEXT_PUBLIC_SENTRY_BACKEND_DSN |
13 | 20 |
|
14 | 21 | FROM node:20-alpine3.19 AS node-alpine |
15 | 22 | FROM golang:1.23.4-alpine3.19 AS go-alpine |
@@ -46,16 +53,14 @@ RUN yarn workspace @sourcebot/error install |
46 | 53 | FROM node-alpine AS web-builder |
47 | 54 | ENV SKIP_ENV_VALIDATION=1 |
48 | 55 | # ----------- |
49 | | -# Global args |
50 | | -ARG SOURCEBOT_VERSION |
51 | | -ENV NEXT_PUBLIC_SOURCEBOT_VERSION=$SOURCEBOT_VERSION |
52 | | -ARG POSTHOG_PAPIK |
53 | | -ENV NEXT_PUBLIC_POSTHOG_PAPIK=$POSTHOG_PAPIK |
54 | | -ARG SENTRY_ENVIRONMENT |
55 | | -ENV NEXT_PUBLIC_SENTRY_ENVIRONMENT=$SENTRY_ENVIRONMENT |
56 | | -ARG SOURCEBOT_CLOUD_ENVIRONMENT |
57 | | -ENV NEXT_PUBLIC_SOURCEBOT_CLOUD_ENVIRONMENT=$SOURCEBOT_CLOUD_ENVIRONMENT |
58 | | -# Local args |
| 56 | +ARG NEXT_PUBLIC_SOURCEBOT_VERSION |
| 57 | +ENV NEXT_PUBLIC_SOURCEBOT_VERSION=$NEXT_PUBLIC_SOURCEBOT_VERSION |
| 58 | +ARG NEXT_PUBLIC_POSTHOG_PAPIK |
| 59 | +ENV NEXT_PUBLIC_POSTHOG_PAPIK=$NEXT_PUBLIC_POSTHOG_PAPIK |
| 60 | +ARG NEXT_PUBLIC_SENTRY_ENVIRONMENT |
| 61 | +ENV NEXT_PUBLIC_SENTRY_ENVIRONMENT=$NEXT_PUBLIC_SENTRY_ENVIRONMENT |
| 62 | +ARG NEXT_PUBLIC_SOURCEBOT_CLOUD_ENVIRONMENT |
| 63 | +ENV NEXT_PUBLIC_SOURCEBOT_CLOUD_ENVIRONMENT=$NEXT_PUBLIC_SOURCEBOT_CLOUD_ENVIRONMENT |
59 | 64 | ARG NEXT_PUBLIC_SENTRY_WEBAPP_DSN |
60 | 65 | ENV NEXT_PUBLIC_SENTRY_WEBAPP_DSN=$NEXT_PUBLIC_SENTRY_WEBAPP_DSN |
61 | 66 | # ----------- |
@@ -102,17 +107,19 @@ ENV SKIP_ENV_VALIDATION=0 |
102 | 107 | # ------ Runner ------ |
103 | 108 | FROM node-alpine AS runner |
104 | 109 | # ----------- |
105 | | -# Global args |
106 | | -ARG SOURCEBOT_VERSION |
107 | | -ENV SOURCEBOT_VERSION=$SOURCEBOT_VERSION |
108 | | -ARG POSTHOG_PAPIK |
109 | | -ENV POSTHOG_PAPIK=$POSTHOG_PAPIK |
110 | | -ARG SENTRY_ENVIRONMENT |
111 | | -ENV SENTRY_ENVIRONMENT=$SENTRY_ENVIRONMENT |
112 | | -# Local args |
| 110 | +ARG NEXT_PUBLIC_SOURCEBOT_VERSION |
| 111 | +ENV NEXT_PUBLIC_SOURCEBOT_VERSION=$NEXT_PUBLIC_SOURCEBOT_VERSION |
| 112 | +ARG NEXT_PUBLIC_POSTHOG_PAPIK |
| 113 | +ENV NEXT_PUBLIC_POSTHOG_PAPIK=$NEXT_PUBLIC_POSTHOG_PAPIK |
| 114 | +ARG NEXT_PUBLIC_SENTRY_ENVIRONMENT |
| 115 | +ENV NEXT_PUBLIC_SENTRY_ENVIRONMENT=$NEXT_PUBLIC_SENTRY_ENVIRONMENT |
| 116 | +ARG NEXT_PUBLIC_SENTRY_WEBAPP_DSN |
| 117 | +ENV NEXT_PUBLIC_SENTRY_WEBAPP_DSN=$NEXT_PUBLIC_SENTRY_WEBAPP_DSN |
| 118 | +ARG NEXT_PUBLIC_SENTRY_BACKEND_DSN |
| 119 | +ENV NEXT_PUBLIC_SENTRY_BACKEND_DSN=$NEXT_PUBLIC_SENTRY_BACKEND_DSN |
113 | 120 | # ----------- |
114 | 121 |
|
115 | | -RUN echo "Sourcebot Version: $SOURCEBOT_VERSION" |
| 122 | +RUN echo "Sourcebot Version: $NEXT_PUBLIC_SOURCEBOT_VERSION" |
116 | 123 |
|
117 | 124 | WORKDIR /app |
118 | 125 | ENV NODE_ENV=production |
@@ -172,17 +179,6 @@ COPY --from=shared-libs-builder /app/packages/error ./packages/error |
172 | 179 |
|
173 | 180 | # Configure dependencies |
174 | 181 | RUN apk add --no-cache git ca-certificates bind-tools tini jansson wget supervisor uuidgen curl perl jq redis postgresql postgresql-contrib openssl util-linux unzip |
175 | | -RUN curl -sL https://sentry.io/get-cli/ | sh |
176 | | - |
177 | | -# Install grafana alloy. libc6-compat is required because alloy dynamically links against glibc which doesn't exist in alpine by default |
178 | | -# @nocheckin: figure out how to handle this for self hosted case (especially the config) |
179 | | -RUN apk add --no-cache libc6-compat |
180 | | -RUN wget https://github.com/grafana/alloy/releases/download/v1.7.0/alloy-linux-amd64.zip \ |
181 | | - && unzip alloy-linux-amd64.zip \ |
182 | | - && mv alloy-linux-amd64 /usr/local/bin/alloy \ |
183 | | - && chmod +x /usr/local/bin/alloy \ |
184 | | - && rm alloy-linux-amd64.zip |
185 | | -COPY grafana.alloy . |
186 | 182 |
|
187 | 183 | # Configure the database |
188 | 184 | RUN mkdir -p /run/postgresql && \ |
|
0 commit comments