AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
feat(rnd) Add dockerfiles (#7523)
Aarushi699087e2895d
diff --git a/.dockerignore b/.dockerignoreindex 89f8a2a42a..9a2289cf98 100644--- a/.dockerignore+++ b/.dockerignore@@ -23,6 +23,16 @@# Frontend!frontend/build/web/+# rnd+!rnd/+# Explicitly re-ignore some folders.***/__pycache__+# rnd+rnd/autogpt_builder/.next/+rnd/autogpt_builder/node_modules+rnd/autogpt_builder/.env.example+rnd/autogpt_builder/.env.local++diff --git a/rnd/autogpt_builder/Dockerfile b/rnd/autogpt_builder/Dockerfilenew file mode 100644index 0000000000..60a93f1be3--- /dev/null+++ b/rnd/autogpt_builder/Dockerfile@@ -0,0 +1,32 @@+# Base stage for both dev and prod+FROM node:21-alpine AS base+WORKDIR /app+COPY autogpt_builder/package.json autogpt_builder/yarn.lock ./+RUN yarn install --frozen-lockfile++# Dev stage+FROM base AS dev+ENV NODE_ENV=development+COPY autogpt_builder/ .+EXPOSE 3000+CMD ["npm", "run", "dev"]++# Build stage for prod+FROM base AS build+COPY autogpt_builder/ .+RUN npm run build++# Prod stage+FROM node:21-alpine AS prod+ENV NODE_ENV=production+WORKDIR /app++COPY --from=build /app/package.json /app/yarn.lock ./+RUN yarn install --frozen-lockfile++COPY --from=build /app/.next ./.next+COPY --from=build /app/public ./public+COPY --from=build /app/next.config.js ./next.config.js++EXPOSE 3000+CMD ["npm", "start"]diff --git a/rnd/autogpt_server/.env.example b/rnd/autogpt_server/.env.exampleindex 638f8bfbca..85ed6025d5 100644--- a/rnd/autogpt_server/.env.example+++ b/rnd/autogpt_server/.env.example@@ -3,4 +3,4 @@ DB_USER=agpt_userDB_PASS=pass123DB_NAME=agpt_localDB_PORT=5432-PRISMA_SCHEMA="schema_postgres.prisma"\ No newline at end of file+PRISMA_SCHEMA="schema_postgres.prisma"diff --git a/rnd/autogpt_server/Dockerfile b/rnd/autogpt_server/Dockerfilenew file mode 100644index 0000000000..3d08141ffb--- /dev/null+++ b/rnd/autogpt_server/Dockerfile@@ -0,0 +1,44 @@+FROM python:3.11-slim-buster as server_base++# Set environment variables+ENV PYTHONDONTWRITEBYTECODE 1+ENV PYTHONUNBUFFERED 1+++WORKDIR /app++RUN apt-get update \+ && apt-get install -y build-essential curl ffmpeg wget libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev \+ && apt-get clean \+ && rm -rf /var/lib/apt/lists/* \+ && wget https://github.com/git/git/archive/v2.28.0.tar.gz -O git.tar.gz \+ && tar -zxf git.tar.gz \+ && cd git-* \+ && make prefix=/usr all \+ && make prefix=/usr install+++ENV POETRY_VERSION=1.8.3 \+ POETRY_HOME="/opt/poetry" \+ POETRY_NO_INTERACTION=1 \+ POETRY_VIRTUALENVS_CREATE=false \+ PATH="$POETRY_HOME/bin:$PATH"+RUN pip3 install poetry++COPY rnd/autogpt_server /app/rnd/autogpt_server+COPY autogpt /app/autogpt+COPY forge /app/forge++WORKDIR /app/rnd/autogpt_server++# Install dependencies+RUN poetry install --no-interaction --no-ansi++RUN poetry run prisma generate++FROM server_base as server++ENV PORT=8000+ENV DATABASE_URL=""++CMD ["poetry", "run", "app"]diff --git a/rnd/autogpt_server/migrations/20240719161138_init/migration.sql b/rnd/autogpt_server/migrations/20240719161138_init/migration.sqlnew file mode 100644index 0000000000..c23105bc0a--- /dev/null+++ b/rnd/autogpt_server/migrations/20240719161138_init/migration.sql@@ -0,0 +1,128 @@+-- CreateTable+CREATE TABLE "AgentGraph" (+ "id" TEXT NOT NULL,+ "version" INTEGER NOT NULL DEFAULT 1,+ "name" TEXT,+ "description" TEXT,+ "isActive" BOOLEAN NOT NULL DEFAULT true,+ "isTemplate" BOOLEAN NOT NULL DEFAULT false,++ CONSTRAINT "AgentGraph_pkey" PRIMARY KEY ("id","version")+);++-- CreateTable+CREATE TABLE "AgentNode" (+ "id" TEXT NOT NULL,+ "agentBlockId" TEXT NOT NULL,+ "agentGraphId" TEXT NOT NULL,+ "agentGraphVersion" INTEGER NOT NULL DEFAULT 1,+ "constantInput" TEXT NOT NULL DEFAULT '{}',+ "metadata" TEXT NOT NULL DEFAULT '{}',++ CONSTRAINT "AgentNode_pkey" PRIMARY KEY ("id")+);++-- CreateTable+CREATE TABLE "AgentNodeLink" (+ "id" TEXT NOT NULL,+ "agentNodeSourceId" TEXT NOT NULL,+ "sourceName" TEXT NOT NULL,+ "agentNodeSinkId" TEXT NOT NULL,+ "sinkName" TEXT NOT NULL,++ CONSTRAINT "AgentNodeLink_pkey" PRIMARY KEY ("id")+);++-- CreateTable+CREATE TABLE "AgentBlock" (+ "id" TEXT NOT NULL,+ "name" TEXT NOT NULL,+ "inputSchema" TEXT NOT NULL,+ "outputSchema" TEXT NOT NULL,++ CONSTRAINT "AgentBlock_pkey" PRIMARY KEY ("id")+);++-- CreateTable+CREATE TABLE "AgentGraphExecution" (+ "id" TEXT NOT NULL,+ "agentGraphId" TEXT NOT NULL,+ "agentGraphVersion" INTEGER NOT NULL DEFAULT 1,++ CONSTRAINT "AgentGraphExecution_pkey" PRIMARY KEY ("id")+);++-- CreateTable+CREATE TABLE "AgentNodeExecution" (+ "id" TEXT NOT NULL,+ "agentGraphExecutionId" TEXT NOT NULL,+ "agentNodeId" TEXT NOT NULL,+ "executionStatus" TEXT NOT NULL,+ "addedTime" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,+ "queuedTime" TIMESTAMP(3),+ "startedTime" TIMESTAMP(3),+ "endedTime" TIMESTAMP(3),++ CONSTRAINT "AgentNodeExecution_pkey" PRIMARY KEY ("id")+);++-- CreateTable+CREATE TABLE "AgentNodeExecutionInputOutput" (+ "id" TEXT NOT NULL,+ "name" TEXT NOT NULL,+ "data" TEXT NOT NULL,+ "time" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,+ "referencedByInputExecId" TEXT,+ "referencedByOutputExecId" TEXT,++ CONSTRAINT "AgentNodeExecutionInputOutput_pkey" PRIMARY KEY ("id")+);++-- CreateTable+CREATE TABLE "AgentGraphExecutionSchedule" (+ "id" TEXT NOT NULL,+ "agentGraphId" TEXT NOT NULL,+ "agentGraphVersion" INTEGER NOT NULL DEFAULT 1,+ "schedule" TEXT NOT NULL,+ "isEnabled" BOOLEAN NOT NULL DEFAULT true,+ "inputData" TEXT NOT NULL,+ "lastUpdated" TIMESTAMP(3) NOT NULL,++ CONSTRAINT "AgentGraphExecutionSchedule_pkey" PRIMARY KEY ("id")+);++-- CreateIndex+CREATE UNIQUE INDEX "AgentBlock_name_key" ON "AgentBlock"("name");++-- CreateIndex+CREATE INDEX "AgentGraphExecutionSchedule_isEnabled_idx" ON "AgentGraphExecutionSchedule"("isEnabled");++-- AddForeignKey+ALTER TABLE "AgentNode" ADD CONSTRAINT "AgentNode_agentBlockId_fkey" FOREIGN KEY ("agentBlockId") REFERENCES "AgentBlock"("id") ON DELETE RESTRICT ON UPDATE CASCADE;++-- AddForeignKey+ALTER TABLE "AgentNode" ADD CONSTRAINT "AgentNode_agentGraphId_agentGraphVersion_fkey" FOREIGN KEY ("agentGraphId", "agentGraphVersion") REFERENCES "AgentGraph"("id", "version") ON DELETE RESTRICT ON UPDATE CASCADE;++-- AddForeignKey+ALTER TABLE "AgentNodeLink" ADD CONSTRAINT "AgentNodeLink_agentNodeSourceId_fkey" FOREIGN KEY ("agentNodeSourceId") REFERENCES "AgentNode"("id") ON DELETE RESTRICT ON UPDATE CASCADE;++-- AddForeignKey+ALTER TABLE "AgentNodeLink" ADD CONSTRAINT "AgentNodeLink_agentNodeSinkId_fkey" FOREIGN KEY ("agentNodeSinkId") REFERENCES "AgentNode"("id") ON DELETE RESTRICT ON UPDATE CASCADE;++-- AddForeignKey+ALTER TABLE "AgentGraphExecution" ADD CONSTRAINT "AgentGraphExecution_agentGraphId_agentGraphVersion_fkey" FOREIGN KEY ("agentGraphId", "agentGraphVersion") REFERENCES "AgentGraph"("id", "version") ON DELETE RESTRICT ON UPDATE CASCADE;++-- AddForeignKey+ALTER TABLE "AgentNodeExecution" ADD CONSTRAINT "AgentNodeExecution_agentGraphExecutionId_fkey" FOREIGN KEY ("agentGraphExecutionId") REFERENCES "AgentGraphExecution"("id") ON DELETE RESTRICT ON UPDATE CASCADE;++-- AddForeignKey+ALTER TABLE "AgentNodeExecution" ADD CONSTRAINT "AgentNodeExecution_agentNodeId_fkey" FOREIGN KEY ("agentNodeId") REFERENCES "AgentNode"("id") ON DELETE RESTRICT ON UPDATE CASCADE;++-- AddForeignKey+ALTER TABLE "AgentNodeExecutionInputOutput" ADD CONSTRAINT "AgentNodeExecutionInputOutput_referencedByInputExecId_fkey" FOREIGN KEY ("referencedByInputExecId") REFERENCES "AgentNodeExecution"("id") ON DELETE SET NULL ON UPDATE CASCADE;++-- AddForeignKey+ALTER TABLE "AgentNodeExecutionInputOutput" ADD CONSTRAINT "AgentNodeExecutionInputOutput_referencedByOutputExecId_fkey" FOREIGN KEY ("referencedByOutputExecId") REFERENCES "AgentNodeExecution"("id") ON DELETE SET NULL ON UPDATE CASCADE;++-- AddForeignKey+ALTER TABLE "AgentGraphExecutionSchedule" ADD CONSTRAINT "AgentGraphExecutionSchedule_agentGraphId_agentGraphVersion_fkey" FOREIGN KEY ("agentGraphId", "agentGraphVersion") REFERENCES "AgentGraph"("id", "version") ON DELETE RESTRICT ON UPDATE CASCADE;diff --git a/rnd/autogpt_server/migrations/migration_lock.toml b/rnd/autogpt_server/migrations/migration_lock.tomlindex e5e5c4705a..6fcf33dafb 100644--- a/rnd/autogpt_server/migrations/migration_lock.toml+++ b/rnd/autogpt_server/migrations/migration_lock.toml@@ -1,3 +1,3 @@# Please do not edit this file manually# It should be added in your version-control system (i.e. Git)-provider = "sqlite"\ No newline at end of file+provider = "sqlite"diff --git a/rnd/autogpt_server/schema.prisma b/rnd/autogpt_server/schema.prismaindex 9e03edc027..1aabe7bbfb 100644--- a/rnd/autogpt_server/schema.prisma+++ b/rnd/autogpt_server/schema.prisma@@ -1,6 +1,6 @@datasource db {- provider = "sqlite"- url = "file:./database.db"+ provider = "postgresql"+ url = env("DATABASE_URL")}generator client {