From d7f40cfda79b5fef9a94677fdd5b7fbe6a2df53c Mon Sep 17 00:00:00 2001 From: nsxshota Date: Thu, 30 Nov 2023 16:47:30 +0900 Subject: [PATCH] =?UTF-8?q?=E6=9C=AC=E5=AE=B6=E3=81=AE=E8=B8=8F=E8=A5=B2?= =?UTF-8?q?=E3=81=AE=E3=81=9F=E3=82=81=E3=80=81Dockerfile=E3=82=92?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cdk.Dockerfile | 20 ++++++++++++++ dev.Dockerfile | 2 +- scripts/{cdk => aws}/.env.example | 0 scripts/{cdk => aws}/.gitignore | 0 scripts/{cdk => aws}/.npmignore | 0 scripts/{cdk => aws}/README.md | 0 scripts/{cdk => aws}/bin/cdk.ts | 0 scripts/{cdk => aws}/cdk.json | 0 scripts/{cdk => aws}/delete-docker-images.sh | 0 scripts/{cdk => aws}/delete-ecr.sh | 0 scripts/{cdk => aws}/jest.config.js | 0 scripts/{cdk => aws}/lib/cdk-stack.ts | 0 scripts/{cdk => aws}/lib/construct/backend.ts | 0 scripts/{cdk => aws}/lib/construct/db.ts | 0 scripts/{cdk => aws}/lib/construct/ecr.ts | 0 .../{cdk => aws}/lib/construct/frontend.ts | 0 scripts/{cdk => aws}/lib/construct/iam.ts | 0 scripts/{cdk => aws}/lib/construct/index.ts | 0 scripts/{cdk => aws}/lib/construct/network.ts | 0 scripts/{cdk => aws}/package-lock.json | 0 scripts/{cdk => aws}/package.json | 0 scripts/{cdk => aws}/test/cdk.test.ts | 0 src/frontend/cdk.Dockerfile | 26 +++++++++++++++++++ src/frontend/dev.Dockerfile | 4 +-- 24 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 cdk.Dockerfile rename scripts/{cdk => aws}/.env.example (100%) rename scripts/{cdk => aws}/.gitignore (100%) rename scripts/{cdk => aws}/.npmignore (100%) rename scripts/{cdk => aws}/README.md (100%) rename scripts/{cdk => aws}/bin/cdk.ts (100%) rename scripts/{cdk => aws}/cdk.json (100%) rename scripts/{cdk => aws}/delete-docker-images.sh (100%) rename scripts/{cdk => aws}/delete-ecr.sh (100%) rename scripts/{cdk => aws}/jest.config.js (100%) rename scripts/{cdk => aws}/lib/cdk-stack.ts (100%) rename scripts/{cdk => aws}/lib/construct/backend.ts (100%) rename scripts/{cdk => aws}/lib/construct/db.ts (100%) rename scripts/{cdk => aws}/lib/construct/ecr.ts (100%) rename scripts/{cdk => aws}/lib/construct/frontend.ts (100%) rename scripts/{cdk => aws}/lib/construct/iam.ts (100%) rename scripts/{cdk => aws}/lib/construct/index.ts (100%) rename scripts/{cdk => aws}/lib/construct/network.ts (100%) rename scripts/{cdk => aws}/package-lock.json (100%) rename scripts/{cdk => aws}/package.json (100%) rename scripts/{cdk => aws}/test/cdk.test.ts (100%) create mode 100644 src/frontend/cdk.Dockerfile diff --git a/cdk.Dockerfile b/cdk.Dockerfile new file mode 100644 index 000000000..44ccf0acb --- /dev/null +++ b/cdk.Dockerfile @@ -0,0 +1,20 @@ +FROM --platform=linux/amd64 python:3.10-slim + +WORKDIR /app + +# Install Poetry +RUN apt-get update && apt-get install gcc g++ curl build-essential postgresql-server-dev-all -y +RUN curl -sSL https://install.python-poetry.org | python3 - +# # Add Poetry to PATH +ENV PATH="${PATH}:/root/.local/bin" +# # Copy the pyproject.toml and poetry.lock files +COPY poetry.lock pyproject.toml ./ +# Copy the rest of the application codes +COPY ./ ./ + +# Install dependencies +RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi + +RUN poetry add pymysql==1.0.2 + +CMD ["uvicorn", "--factory", "src.backend.langflow.main:create_app", "--host", "0.0.0.0", "--port", "7860", "--reload", "--log-level", "debug"] diff --git a/dev.Dockerfile b/dev.Dockerfile index ce5715e1f..ed3631516 100644 --- a/dev.Dockerfile +++ b/dev.Dockerfile @@ -1,4 +1,4 @@ -FROM --platform=linux/amd64 python:3.10-slim +FROM python:3.10-slim WORKDIR /app diff --git a/scripts/cdk/.env.example b/scripts/aws/.env.example similarity index 100% rename from scripts/cdk/.env.example rename to scripts/aws/.env.example diff --git a/scripts/cdk/.gitignore b/scripts/aws/.gitignore similarity index 100% rename from scripts/cdk/.gitignore rename to scripts/aws/.gitignore diff --git a/scripts/cdk/.npmignore b/scripts/aws/.npmignore similarity index 100% rename from scripts/cdk/.npmignore rename to scripts/aws/.npmignore diff --git a/scripts/cdk/README.md b/scripts/aws/README.md similarity index 100% rename from scripts/cdk/README.md rename to scripts/aws/README.md diff --git a/scripts/cdk/bin/cdk.ts b/scripts/aws/bin/cdk.ts similarity index 100% rename from scripts/cdk/bin/cdk.ts rename to scripts/aws/bin/cdk.ts diff --git a/scripts/cdk/cdk.json b/scripts/aws/cdk.json similarity index 100% rename from scripts/cdk/cdk.json rename to scripts/aws/cdk.json diff --git a/scripts/cdk/delete-docker-images.sh b/scripts/aws/delete-docker-images.sh similarity index 100% rename from scripts/cdk/delete-docker-images.sh rename to scripts/aws/delete-docker-images.sh diff --git a/scripts/cdk/delete-ecr.sh b/scripts/aws/delete-ecr.sh similarity index 100% rename from scripts/cdk/delete-ecr.sh rename to scripts/aws/delete-ecr.sh diff --git a/scripts/cdk/jest.config.js b/scripts/aws/jest.config.js similarity index 100% rename from scripts/cdk/jest.config.js rename to scripts/aws/jest.config.js diff --git a/scripts/cdk/lib/cdk-stack.ts b/scripts/aws/lib/cdk-stack.ts similarity index 100% rename from scripts/cdk/lib/cdk-stack.ts rename to scripts/aws/lib/cdk-stack.ts diff --git a/scripts/cdk/lib/construct/backend.ts b/scripts/aws/lib/construct/backend.ts similarity index 100% rename from scripts/cdk/lib/construct/backend.ts rename to scripts/aws/lib/construct/backend.ts diff --git a/scripts/cdk/lib/construct/db.ts b/scripts/aws/lib/construct/db.ts similarity index 100% rename from scripts/cdk/lib/construct/db.ts rename to scripts/aws/lib/construct/db.ts diff --git a/scripts/cdk/lib/construct/ecr.ts b/scripts/aws/lib/construct/ecr.ts similarity index 100% rename from scripts/cdk/lib/construct/ecr.ts rename to scripts/aws/lib/construct/ecr.ts diff --git a/scripts/cdk/lib/construct/frontend.ts b/scripts/aws/lib/construct/frontend.ts similarity index 100% rename from scripts/cdk/lib/construct/frontend.ts rename to scripts/aws/lib/construct/frontend.ts diff --git a/scripts/cdk/lib/construct/iam.ts b/scripts/aws/lib/construct/iam.ts similarity index 100% rename from scripts/cdk/lib/construct/iam.ts rename to scripts/aws/lib/construct/iam.ts diff --git a/scripts/cdk/lib/construct/index.ts b/scripts/aws/lib/construct/index.ts similarity index 100% rename from scripts/cdk/lib/construct/index.ts rename to scripts/aws/lib/construct/index.ts diff --git a/scripts/cdk/lib/construct/network.ts b/scripts/aws/lib/construct/network.ts similarity index 100% rename from scripts/cdk/lib/construct/network.ts rename to scripts/aws/lib/construct/network.ts diff --git a/scripts/cdk/package-lock.json b/scripts/aws/package-lock.json similarity index 100% rename from scripts/cdk/package-lock.json rename to scripts/aws/package-lock.json diff --git a/scripts/cdk/package.json b/scripts/aws/package.json similarity index 100% rename from scripts/cdk/package.json rename to scripts/aws/package.json diff --git a/scripts/cdk/test/cdk.test.ts b/scripts/aws/test/cdk.test.ts similarity index 100% rename from scripts/cdk/test/cdk.test.ts rename to scripts/aws/test/cdk.test.ts diff --git a/src/frontend/cdk.Dockerfile b/src/frontend/cdk.Dockerfile new file mode 100644 index 000000000..0b33e09b8 --- /dev/null +++ b/src/frontend/cdk.Dockerfile @@ -0,0 +1,26 @@ +#baseline +FROM --platform=linux/amd64 node:19-bullseye-slim AS base +RUN mkdir -p /home/node/app +RUN chown -R node:node /home/node && chmod -R 770 /home/node +RUN apt-get update && apt-get install -y jq curl +WORKDIR /home/node/app + +# client build +FROM base AS builder-client +ARG BACKEND_URL +ENV BACKEND_URL $BACKEND_URL +RUN echo "BACKEND_URL: $BACKEND_URL" + +WORKDIR /home/node/app +COPY --chown=node:node . ./ + +COPY ./set_proxy.sh . +RUN chmod +x set_proxy.sh && \ + cat set_proxy.sh | tr -d '\r' > set_proxy_unix.sh && \ + chmod +x set_proxy_unix.sh && \ + ./set_proxy_unix.sh + +USER node + +RUN npm install --loglevel warn +CMD ["npm", "run", "dev:docker"] \ No newline at end of file diff --git a/src/frontend/dev.Dockerfile b/src/frontend/dev.Dockerfile index 0b33e09b8..8678b02dd 100644 --- a/src/frontend/dev.Dockerfile +++ b/src/frontend/dev.Dockerfile @@ -1,8 +1,8 @@ #baseline -FROM --platform=linux/amd64 node:19-bullseye-slim AS base +FROM node:19-bullseye-slim AS base RUN mkdir -p /home/node/app RUN chown -R node:node /home/node && chmod -R 770 /home/node -RUN apt-get update && apt-get install -y jq curl +RUN apt-get update && apt-get install -y jq WORKDIR /home/node/app # client build