mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-10 22:55:16 -05:00
feat(bun): upgrade to bun, reduce docker image size by 95%, upgrade docs & ci (#371)
* migrate to bun * added envvars to drizzle * upgrade bun devcontainer feature to a valid one * added bun, docker not working * updated envvars, updated to bunder and esnext modules * fixed build, reinstated otel * feat: optimized multi-stage docker images * add coerce for boolean envvar * feat: add docker-compose configuration for local LLM services and remove legacy Dockerfile and entrypoint script * feat: add docker-compose files for local and production environments, and implement GitHub Actions for Docker image build and publish * refactor: remove unused generateStaticParams function from various API routes and maintain dynamic rendering * cleanup * upgraded bun * updated ci * fixed build --------- Co-authored-by: Aditya Tripathi <aditya@climactic.co>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import { FreestyleSandboxes } from 'freestyle-sandboxes'
|
||||
import { createContext, Script } from 'vm'
|
||||
import { env } from '@/lib/env'
|
||||
import { createLogger } from '@/lib/logs/console-logger'
|
||||
|
||||
// Explicitly export allowed methods
|
||||
@@ -27,8 +28,8 @@ function resolveCodeVariables(
|
||||
const envVarMatches = resolvedCode.match(/\{\{([^}]+)\}\}/g) || []
|
||||
for (const match of envVarMatches) {
|
||||
const varName = match.slice(2, -2).trim()
|
||||
// Priority: 1. Environment variables from workflow, 2. Params, 3. process.env
|
||||
const varValue = envVars[varName] || params[varName] || process.env[varName] || ''
|
||||
// Priority: 1. Environment variables from workflow, 2. Params
|
||||
const varValue = envVars[varName] || params[varName] || ''
|
||||
// Wrap the value in quotes to ensure it's treated as a string literal
|
||||
resolvedCode = resolvedCode.replace(match, JSON.stringify(varValue))
|
||||
}
|
||||
@@ -72,7 +73,7 @@ export async function POST(req: NextRequest) {
|
||||
let executionMethod = 'vm' // Default execution method
|
||||
|
||||
// Try to use Freestyle if the API key is available
|
||||
if (process.env.FREESTYLE_API_KEY) {
|
||||
if (env.FREESTYLE_API_KEY) {
|
||||
try {
|
||||
logger.info(`[${requestId}] Using Freestyle for code execution`)
|
||||
executionMethod = 'freestyle'
|
||||
@@ -99,7 +100,7 @@ export async function POST(req: NextRequest) {
|
||||
}
|
||||
|
||||
const freestyle = new FreestyleSandboxes({
|
||||
apiKey: process.env.FREESTYLE_API_KEY,
|
||||
apiKey: env.FREESTYLE_API_KEY,
|
||||
})
|
||||
|
||||
// Wrap code in export default to match Freestyle's expectations
|
||||
|
||||
Reference in New Issue
Block a user