Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Add containerized app [WIP]
Tomas Valenta6a7ffb12f851
diff --git a/.dockerignore b/.dockerignorenew file mode 100644index 000000000..8bc1b2cdc--- /dev/null+++ b/.dockerignore@@ -0,0 +1,14 @@+Dockerfile+.dockerignore+node_modules+.codesandbox+.next+.vscode+api-service+.env.example+.python-version+csb.nix+npm-debug.log+README.md+docker+.git\ No newline at end of filediff --git a/.env.example b/.env.exampleindex 96b1c5b59..e0eb8500e 100644--- a/.env.example+++ b/.env.example@@ -1,5 +1,3 @@-# Keys-# OpenAIOPENAI_API_KEY=@@ -8,11 +6,15 @@ OPENAI_API_KEY=# The preconfigured value with localhost is for the development with local Supabase.# Add `?pgbouncer=true&connection_limit=1` to the connection string if you are deploying to production.SUPABASE_POSTGRES_URL=postgresql://postgres:postgres@localhost:54322/postgres+# Service role key you can get after starting local Supabase with `yarn db:start` ("service_role key: eyJh......")-SUPABASE_SERVICE_ROLE_KEY=+# The following default key is generated by the local Supabase start and doesn't change+SUPABASE_SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0# URL for the Supabase DB.# The preconfigured value with localhost is for the development with local Supabase.NEXT_PUBLIC_SUPABASE_URL=http://localhost:54321+# Anonymous key you can get after starting local Supabase with `yarn db:start` ("anon key: eyJh......")-NEXT_PUBLIC_SUPABASE_ANON_KEY=+# The following default key is generated by the local Supabase start and doesn't change+NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IUdiff --git a/Dockerfile b/Dockerfilenew file mode 100644index 000000000..7e25433ea--- /dev/null+++ b/Dockerfile@@ -0,0 +1,23 @@+FROM node:18-alpine++# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.+RUN apk add --no-cache libc6-compat+WORKDIR /app++# Install dependencies based on the preferred package manager+COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./+COPY prisma/schema.prisma ./prisma/schema.prisma+RUN \+ if [ -f yarn.lock ]; then yarn --frozen-lockfile; \+ elif [ -f package-lock.json ]; then npm ci; \+ elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \+ else echo "Lockfile not found." && exit 1; \+ fi++COPY . .++EXPOSE 3000++ENV PORT 3000++CMD ["yarn", "next", "dev"]diff --git a/docker-compose.yml b/docker-compose.ymlnew file mode 100644index 000000000..7d0ccbd55--- /dev/null+++ b/docker-compose.yml@@ -0,0 +1,43 @@+version: "3.8"++services:+ api:+ image: gcr.io/e2b/api:latest+ build:+ context: ./api-service+ environment:+ - PORT=49155+ - NEXT_PUBLIC_SUPABASE_URL=${NEXT_PUBLIC_SUPABASE_URL}+ - SUPABASE_SERVICE_ROLE_KEY=${SUPABASE_SERVICE_ROLE_KEY}+ - OPENAI_API_KEY=${OPENAI_API_KEY}+ expose:+ - 49155+ networks:+ - supabase-local-net+ - api-net++ app-dev:+ image: gcr.io/e2b/app-dev:latest+ build:+ context: ./+ depends_on:+ - api+ environment:+ - NODE_ENV=development+ - NEXT_PUBLIC_SUPABASE_URL=${NEXT_PUBLIC_SUPABASE_URL}+ - SUPABASE_POSTGRES_POOL_URL=${SUPABASE_POSTGRES_POOL_URL}+ - SUPABASE_SERVICE_ROLE_KEY=${SUPABASE_SERVICE_ROLE_KEY}+ - NEXT_PUBLIC_SUPABASE_ANON_KEY=${NEXT_PUBLIC_SUPABASE_ANON_KEY}+ ports:+ - 3000:3000+ networks:+ - supabase-local-net+ - api-net++networks:+ api-net:+ driver: bridge+ supabase-local-net:+ # This name identified the network -+ name: supabase_network_workspace+ external: true\ No newline at end of filediff --git a/package.json b/package.jsonindex be32a12c5..4ffa3dd7f 100644--- a/package.json+++ b/package.json@@ -10,7 +10,8 @@"start:playground": "cd api-service/playground && yarn dev","install:api-service": "cd api-service && poetry install && cd playground && yarn","install:all": "yarn && yarn install:api-service",- "start": "next start",+ "start": "yarn db:start && docker compose up",+ "stop": "docker compose down && yarn db:stop","lint": "next lint","lint:fix": "next lint --fix","dev:debug": "NODE_OPTIONS='--inspect' next dev",@@ -18,8 +19,8 @@"db:pull": "prisma db pull","supabase:generate": "supabase gen types typescript --project-id \"ntjfcwpzsxugrykskdgi\" --schema public > db/supabase.ts","postinstall": "yarn db:generate",- "db:start": "supabase start -x imgproxy,storage-api,studio",- "db:stop": "supabase stop"+ "db:start": "npx --yes supabase start -x imgproxy,storage-api,studio",+ "db:stop": "npx --yes supabase stop"},"dependencies": {"@devbookhq/splitter": "^1.4.0",@@ -78,4 +79,4 @@"tailwindcss": "^3.2.7","typescript": "^4.9.5"}-}+}\ No newline at end of file