fix build

This commit is contained in:
bkellam 2025-03-21 13:15:41 -07:00
parent 4c52059ecc
commit 338993e8cb
12 changed files with 30 additions and 33 deletions

View file

@ -53,10 +53,6 @@ REDIS_URL="redis://localhost:6379"
# Misc # Misc
# Set during docker build of application
# Used to disable env var validation at build time
# DOCKER_BUILD=1
# Generated using: # Generated using:
# openssl rand -base64 24 # openssl rand -base64 24
SOURCEBOT_ENCRYPTION_KEY="00000000000000000000000000000000" SOURCEBOT_ENCRYPTION_KEY="00000000000000000000000000000000"

View file

@ -41,7 +41,7 @@ RUN yarn workspace @sourcebot/error install --frozen-lockfile
# ------ Build Web ------ # ------ Build Web ------
FROM node-alpine AS web-builder FROM node-alpine AS web-builder
ENV DOCKER_BUILD=1 ENV SKIP_ENV_VALIDATION=1
# ----------- # -----------
# Global args # Global args
ARG SOURCEBOT_VERSION ARG SOURCEBOT_VERSION
@ -73,12 +73,12 @@ RUN yarn workspace @sourcebot/web install --frozen-lockfile
ENV NEXT_TELEMETRY_DISABLED=1 ENV NEXT_TELEMETRY_DISABLED=1
RUN yarn workspace @sourcebot/web build RUN yarn workspace @sourcebot/web build
ENV DOCKER_BUILD=0 ENV SKIP_ENV_VALIDATION=0
# ------------------------------ # ------------------------------
# ------ Build Backend ------ # ------ Build Backend ------
FROM node-alpine AS backend-builder FROM node-alpine AS backend-builder
ENV DOCKER_BUILD=1 ENV SKIP_ENV_VALIDATION=1
WORKDIR /app WORKDIR /app
COPY package.json yarn.lock* ./ COPY package.json yarn.lock* ./
@ -91,7 +91,7 @@ COPY --from=shared-libs-builder /app/packages/crypto ./packages/crypto
COPY --from=shared-libs-builder /app/packages/error ./packages/error COPY --from=shared-libs-builder /app/packages/error ./packages/error
RUN yarn workspace @sourcebot/backend install --frozen-lockfile RUN yarn workspace @sourcebot/backend install --frozen-lockfile
RUN yarn workspace @sourcebot/backend build RUN yarn workspace @sourcebot/backend build
ENV DOCKER_BUILD=0 ENV SKIP_ENV_VALIDATION=0
# ------------------------------ # ------------------------------
# ------ Runner ------ # ------ Runner ------

View file

@ -4,7 +4,7 @@
"packages/*" "packages/*"
], ],
"scripts": { "scripts": {
"build": "yarn workspaces run build", "build": "cross-env SKIP_ENV_VALIDATION=1 yarn workspaces run build",
"test": "yarn workspaces run test", "test": "yarn workspaces run test",
"dev": "yarn dev:prisma:migrate:dev && npm-run-all --print-label --parallel dev:zoekt dev:backend dev:web", "dev": "yarn dev:prisma:migrate:dev && npm-run-all --print-label --parallel dev:zoekt dev:backend dev:web",

View file

@ -8,7 +8,7 @@
"dev:watch": "tsc-watch --preserveWatchOutput --onSuccess \"yarn dev --cacheDir ../../.sourcebot\"", "dev:watch": "tsc-watch --preserveWatchOutput --onSuccess \"yarn dev --cacheDir ../../.sourcebot\"",
"dev": "node ./dist/index.js", "dev": "node ./dist/index.js",
"build": "tsc", "build": "tsc",
"test": "vitest --config ./vitest.config.ts" "test": "cross-env SKIP_ENV_VALIDATION=1 vitest --config ./vitest.config.ts"
}, },
"devDependencies": { "devDependencies": {
"@types/argparse": "^2.0.16", "@types/argparse": "^2.0.16",
@ -18,6 +18,7 @@
"tsc-watch": "^6.2.0", "tsc-watch": "^6.2.0",
"tsx": "^4.19.1", "tsx": "^4.19.1",
"typescript": "^5.6.2", "typescript": "^5.6.2",
"cross-env": "^7.0.3",
"vitest": "^2.1.9" "vitest": "^2.1.9"
}, },
"dependencies": { "dependencies": {

View file

@ -46,6 +46,5 @@ export const env = createEnv({
}, },
runtimeEnv: process.env, runtimeEnv: process.env,
emptyStringAsUndefined: true, emptyStringAsUndefined: true,
// Skip environment variable validation in Docker builds. skipValidation: process.env.SKIP_ENV_VALIDATION === "1",
skipValidation: process.env.DOCKER_BUILD === "1",
}); });

View file

@ -2,6 +2,7 @@
"name": "@sourcebot/error", "name": "@sourcebot/error",
"main": "dist/index.js", "main": "dist/index.js",
"version": "0.1.0", "version": "0.1.0",
"private": true,
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"postinstall": "yarn build" "postinstall": "yarn build"

View file

@ -1,5 +1,4 @@
import { prisma } from "@/prisma"; import { prisma } from "@/prisma";
import { PageNotFound } from "./components/pageNotFound";
import { auth } from "@/auth"; import { auth } from "@/auth";
import { getOrgFromDomain } from "@/data/org"; import { getOrgFromDomain } from "@/data/org";
import { isServiceError } from "@/lib/utils"; import { isServiceError } from "@/lib/utils";

View file

@ -77,7 +77,7 @@ export const RepositoryTable = ({ isAddNewRepoButtonVisible }: RepositoryTablePr
} }
return columns(domain, isAddNewRepoButtonVisible); return columns(domain, isAddNewRepoButtonVisible);
}, [reposLoading, domain]); }, [reposLoading, domain, isAddNewRepoButtonVisible]);
if (reposError) { if (reposError) {

View file

@ -2,7 +2,6 @@
import { fileSourceResponseSchema, getVersionResponseSchema, listRepositoriesResponseSchema, searchResponseSchema } from "@/lib/schemas"; import { fileSourceResponseSchema, getVersionResponseSchema, listRepositoriesResponseSchema, searchResponseSchema } from "@/lib/schemas";
import { FileSourceRequest, FileSourceResponse, GetVersionResponse, ListRepositoriesResponse, SearchRequest, SearchResponse } from "@/lib/types"; import { FileSourceRequest, FileSourceResponse, GetVersionResponse, ListRepositoriesResponse, SearchRequest, SearchResponse } from "@/lib/types";
import assert from "assert";
export const search = async (body: SearchRequest, domain: string): Promise<SearchResponse> => { export const search = async (body: SearchRequest, domain: string): Promise<SearchResponse> => {
const result = await fetch("/api/search", { const result = await fetch("/api/search", {

View file

@ -27,6 +27,7 @@ export default function Error({ error, reset }: { error: Error & { digest?: stri
statusCode: serviceError.statusCode, statusCode: serviceError.statusCode,
} }
} }
/* eslint-disable no-empty */
} catch {} } catch {}
return { return {

View file

@ -62,7 +62,6 @@ export const env = createEnv({
NEXT_PUBLIC_SOURCEBOT_VERSION: process.env.NEXT_PUBLIC_SOURCEBOT_VERSION, NEXT_PUBLIC_SOURCEBOT_VERSION: process.env.NEXT_PUBLIC_SOURCEBOT_VERSION,
NEXT_PUBLIC_POLLING_INTERVAL_MS: process.env.NEXT_PUBLIC_POLLING_INTERVAL_MS, NEXT_PUBLIC_POLLING_INTERVAL_MS: process.env.NEXT_PUBLIC_POLLING_INTERVAL_MS,
}, },
// Skip environment variable validation in Docker builds. skipValidation: process.env.SKIP_ENV_VALIDATION === "1",
skipValidation: process.env.DOCKER_BUILD === "1",
emptyStringAsUndefined: true, emptyStringAsUndefined: true,
}); });

View file

@ -134,6 +134,8 @@ const initSingleTenancy = async () => {
} }
} }
(async () => {
if (env.SOURCEBOT_TENANCY_MODE === 'single') { if (env.SOURCEBOT_TENANCY_MODE === 'single') {
await initSingleTenancy(); await initSingleTenancy();
} }
})();