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
# Set during docker build of application
# Used to disable env var validation at build time
# DOCKER_BUILD=1
# Generated using:
# openssl rand -base64 24
SOURCEBOT_ENCRYPTION_KEY="00000000000000000000000000000000"

View file

@ -41,7 +41,7 @@ RUN yarn workspace @sourcebot/error install --frozen-lockfile
# ------ Build Web ------
FROM node-alpine AS web-builder
ENV DOCKER_BUILD=1
ENV SKIP_ENV_VALIDATION=1
# -----------
# Global args
ARG SOURCEBOT_VERSION
@ -73,12 +73,12 @@ RUN yarn workspace @sourcebot/web install --frozen-lockfile
ENV NEXT_TELEMETRY_DISABLED=1
RUN yarn workspace @sourcebot/web build
ENV DOCKER_BUILD=0
ENV SKIP_ENV_VALIDATION=0
# ------------------------------
# ------ Build Backend ------
FROM node-alpine AS backend-builder
ENV DOCKER_BUILD=1
ENV SKIP_ENV_VALIDATION=1
WORKDIR /app
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
RUN yarn workspace @sourcebot/backend install --frozen-lockfile
RUN yarn workspace @sourcebot/backend build
ENV DOCKER_BUILD=0
ENV SKIP_ENV_VALIDATION=0
# ------------------------------
# ------ Runner ------

View file

@ -4,7 +4,7 @@
"packages/*"
],
"scripts": {
"build": "yarn workspaces run build",
"build": "cross-env SKIP_ENV_VALIDATION=1 yarn workspaces run build",
"test": "yarn workspaces run test",
"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": "node ./dist/index.js",
"build": "tsc",
"test": "vitest --config ./vitest.config.ts"
"test": "cross-env SKIP_ENV_VALIDATION=1 vitest --config ./vitest.config.ts"
},
"devDependencies": {
"@types/argparse": "^2.0.16",
@ -18,6 +18,7 @@
"tsc-watch": "^6.2.0",
"tsx": "^4.19.1",
"typescript": "^5.6.2",
"cross-env": "^7.0.3",
"vitest": "^2.1.9"
},
"dependencies": {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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