modified: Dockerfile for cdk
This commit is contained in:
parent
83244bcc32
commit
8d08260ae8
6 changed files with 67 additions and 66 deletions
22
Dockerfile
22
Dockerfile
|
|
@ -1,15 +1,19 @@
|
||||||
FROM python:3.10-slim
|
FROM --platform=linux/amd64 python:3.10-slim
|
||||||
|
|
||||||
RUN apt-get update && apt-get install gcc g++ git make -y && apt-get clean \
|
WORKDIR /app
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
RUN useradd -m -u 1000 user
|
|
||||||
USER user
|
|
||||||
ENV HOME=/home/user \
|
|
||||||
PATH=/home/user/.local/bin:$PATH
|
|
||||||
|
|
||||||
WORKDIR $HOME/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 ./ ./
|
||||||
|
|
||||||
COPY --chown=user . $HOME/app
|
# Install dependencies
|
||||||
|
RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi
|
||||||
|
|
||||||
RUN pip install langflow>==0.5.0 -U --user
|
RUN pip install langflow>==0.5.0 -U --user
|
||||||
CMD ["python", "-m", "langflow", "run", "--host", "0.0.0.0", "--port", "7860"]
|
CMD ["python", "-m", "langflow", "run", "--host", "0.0.0.0", "--port", "7860"]
|
||||||
|
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
FROM 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
|
|
||||||
|
|
||||||
CMD ["uvicorn", "--factory", "src.backend.langflow.main:create_app", "--host", "0.0.0.0", "--port", "7860", "--reload", "--log-level", "debug"]
|
|
||||||
15
prod.Dockerfile
Normal file
15
prod.Dockerfile
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
FROM python:3.10-slim
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install gcc g++ git make -y && apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
RUN useradd -m -u 1000 user
|
||||||
|
USER user
|
||||||
|
ENV HOME=/home/user \
|
||||||
|
PATH=/home/user/.local/bin:$PATH
|
||||||
|
|
||||||
|
WORKDIR $HOME/app
|
||||||
|
|
||||||
|
COPY --chown=user . $HOME/app
|
||||||
|
|
||||||
|
RUN pip install langflow>==0.0.86 -U --user
|
||||||
|
CMD ["python", "-m", "langflow", "run", "--host", "0.0.0.0", "--port", "7860"]
|
||||||
|
|
@ -1,16 +1,26 @@
|
||||||
FROM node:20-alpine as frontend_build
|
#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
|
||||||
|
WORKDIR /home/node/app
|
||||||
|
|
||||||
|
# client build
|
||||||
|
FROM base AS builder-client
|
||||||
ARG BACKEND_URL
|
ARG BACKEND_URL
|
||||||
WORKDIR /app
|
ENV BACKEND_URL $BACKEND_URL
|
||||||
|
RUN echo "BACKEND_URL: $BACKEND_URL"
|
||||||
|
|
||||||
COPY ./package.json ./package-lock.json ./tsconfig.json ./vite.config.ts ./index.html ./tailwind.config.js ./postcss.config.js ./prettier.config.js /app/
|
WORKDIR /home/node/app
|
||||||
RUN npm install
|
COPY --chown=node:node . ./
|
||||||
COPY ./src /app/src
|
|
||||||
RUN npm run build
|
|
||||||
|
|
||||||
FROM nginx
|
COPY ./set_proxy.sh .
|
||||||
COPY --from=frontend_build /app/build/ /usr/share/nginx/html
|
RUN chmod +x set_proxy.sh && \
|
||||||
COPY /nginx.conf /etc/nginx/conf.d/default.conf
|
cat set_proxy.sh | tr -d '\r' > set_proxy_unix.sh && \
|
||||||
COPY start-nginx.sh /start-nginx.sh
|
chmod +x set_proxy_unix.sh && \
|
||||||
RUN chmod +x /start-nginx.sh
|
./set_proxy_unix.sh
|
||||||
ENV BACKEND_URL=$BACKEND_URL
|
|
||||||
CMD ["/start-nginx.sh"]
|
USER node
|
||||||
|
|
||||||
|
RUN npm install --loglevel warn
|
||||||
|
CMD ["npm", "run", "dev:docker"]
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
#baseline
|
|
||||||
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
|
|
||||||
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"]
|
|
||||||
16
src/frontend/prod.Dockerfile
Normal file
16
src/frontend/prod.Dockerfile
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
FROM node:20-alpine as frontend_build
|
||||||
|
ARG BACKEND_URL
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY ./package.json ./package-lock.json ./tsconfig.json ./vite.config.ts ./index.html ./tailwind.config.js ./postcss.config.js ./prettier.config.js /app/
|
||||||
|
RUN npm install
|
||||||
|
COPY ./src /app/src
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
FROM nginx
|
||||||
|
COPY --from=frontend_build /app/build/ /usr/share/nginx/html
|
||||||
|
COPY /nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
COPY start-nginx.sh /start-nginx.sh
|
||||||
|
RUN chmod +x /start-nginx.sh
|
||||||
|
ENV BACKEND_URL=$BACKEND_URL
|
||||||
|
CMD ["/start-nginx.sh"]
|
||||||
Loading…
Add table
Add a link
Reference in a new issue