docker fix

This commit is contained in:
Bryan1029384756
2026-02-21 16:13:10 -06:00
parent e6a1a76116
commit dd313cf8c8

View File

@@ -1,10 +1,13 @@
import express from 'express';
import compression from 'compression';
import { execSync } from 'child_process';
import { exec } from 'child_process';
import { promisify } from 'util';
import { existsSync, mkdirSync, cpSync, rmSync, readdirSync, readFileSync } from 'fs';
import { join, dirname } from 'path';
import { fileURLToPath } from 'url';
const execAsync = promisify(exec);
const __dirname = dirname(fileURLToPath(import.meta.url));
const PORT = process.env.PORT || 3000;
@@ -35,9 +38,11 @@ function findLatestRelease() {
return null;
}
function run(cmd, opts = {}) {
async function run(cmd, opts = {}) {
log(`> ${cmd}`);
execSync(cmd, { stdio: 'inherit', timeout: 600_000, ...opts });
const { stdout, stderr } = await execAsync(cmd, { timeout: 600_000, maxBuffer: 50 * 1024 * 1024, ...opts });
if (stdout) process.stdout.write(stdout);
if (stderr) process.stderr.write(stderr);
}
async function triggerBuild(webhookCommit) {
@@ -60,10 +65,11 @@ async function triggerBuild(webhookCommit) {
log('Starting build...');
// Clone
run(`git clone --depth 1 --branch ${GIT_BRANCH} ${GIT_REPO_URL} ${buildDir}`);
await run(`git clone --depth 1 --branch ${GIT_BRANCH} ${GIT_REPO_URL} ${buildDir}`);
// Read the cloned commit hash
const clonedHash = execSync('git rev-parse HEAD', { cwd: buildDir, encoding: 'utf-8' }).trim();
const { stdout: hashOut } = await execAsync('git rev-parse HEAD', { cwd: buildDir });
const clonedHash = hashOut.trim();
log(`Cloned commit: ${clonedHash}`);
// Skip if this commit is already deployed
@@ -74,14 +80,14 @@ async function triggerBuild(webhookCommit) {
}
// Install deps (web workspaces only)
run(
await run(
'npm ci --workspace=apps/web --workspace=packages/shared --workspace=packages/platform-web --include-workspace-root',
{ cwd: buildDir }
);
// Build
const env = { ...process.env, VITE_CONVEX_URL, VITE_LIVEKIT_URL };
run('npm run build:web', { cwd: buildDir, env });
await run('npm run build:web', { cwd: buildDir, env });
// Copy dist to release dir
const distDir = join(buildDir, 'apps', 'web', 'dist');