mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-19 20:50:09 +01:00
port improvements into render/railway docker image
This commit is contained in:
parent
4ff57eee4b
commit
7e9952099a
@ -1,7 +1,6 @@
|
|||||||
# This is the dockerfile spefically to be used with Render.com docker deployments. Do not use
|
# This is the dockerfile spefically to be used with Render.com docker deployments. Do not use
|
||||||
# locally or in other environments as it will not be supported.
|
# locally or in other environments as it will not be supported.
|
||||||
|
|
||||||
|
|
||||||
# Setup base image
|
# Setup base image
|
||||||
FROM ubuntu:jammy-20240627.1 AS base
|
FROM ubuntu:jammy-20240627.1 AS base
|
||||||
|
|
||||||
@ -28,7 +27,9 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
|
|||||||
apt-get install -yq --no-install-recommends nodejs && \
|
apt-get install -yq --no-install-recommends nodejs && \
|
||||||
curl -LO https://github.com/yarnpkg/yarn/releases/download/v1.22.19/yarn_1.22.19_all.deb \
|
curl -LO https://github.com/yarnpkg/yarn/releases/download/v1.22.19/yarn_1.22.19_all.deb \
|
||||||
&& dpkg -i yarn_1.22.19_all.deb \
|
&& dpkg -i yarn_1.22.19_all.deb \
|
||||||
&& rm yarn_1.22.19_all.deb
|
&& rm yarn_1.22.19_all.deb && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Create a group and user with specific UID and GID
|
# Create a group and user with specific UID and GID
|
||||||
RUN groupadd -g $ARG_GID anythingllm && \
|
RUN groupadd -g $ARG_GID anythingllm && \
|
||||||
@ -47,41 +48,43 @@ RUN chmod +x /usr/local/bin/render-entrypoint.sh && \
|
|||||||
USER anythingllm
|
USER anythingllm
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install frontend dependencies
|
# Install & Build frontend layer
|
||||||
FROM base AS frontend-deps
|
FROM base AS frontend-build
|
||||||
COPY ./frontend/package.json ./frontend/yarn.lock ./frontend/
|
COPY --chown=anythingllm:anythingllm ./frontend /app/frontend/
|
||||||
WORKDIR /app/frontend
|
WORKDIR /app/frontend
|
||||||
RUN yarn install --network-timeout 100000 && yarn cache clean
|
RUN yarn install --network-timeout 100000 && yarn cache clean
|
||||||
|
RUN yarn build && \
|
||||||
|
cp -r dist /tmp/frontend-build && \
|
||||||
|
rm -rf * && \
|
||||||
|
cp -r /tmp/frontend-build dist && \
|
||||||
|
rm -rf /tmp/frontend-build
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install server dependencies
|
# Install server dependencies
|
||||||
FROM base as server-deps
|
FROM base as server-build
|
||||||
COPY ./server/package.json ./server/yarn.lock ./server/
|
COPY ./server /app/server/
|
||||||
WORKDIR /app/server
|
WORKDIR /app/server
|
||||||
RUN yarn install --production --network-timeout 100000 && yarn cache clean
|
RUN yarn install --production --network-timeout 100000 && yarn cache clean
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Build the frontend
|
# Build collector deps (this also downloads proper chrome for collector in /app/.cache so that needs to be
|
||||||
FROM frontend-deps as build-stage
|
# transferred properly in prod-build stage.
|
||||||
COPY ./frontend/ ./frontend/
|
FROM base AS collector-build
|
||||||
WORKDIR /app/frontend
|
COPY ./collector /app/collector
|
||||||
RUN yarn build && yarn cache clean && rm -rf node_modules
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Setup the server
|
|
||||||
FROM server-deps as production-stage
|
|
||||||
COPY --chown=anythingllm:anythingllm ./server/ ./server/
|
|
||||||
|
|
||||||
# Copy built static frontend files to the server public directory
|
|
||||||
COPY --chown=anythingllm:anythingllm --from=build-stage /app/frontend/dist ./server/public
|
|
||||||
|
|
||||||
# Copy the collector
|
|
||||||
COPY --chown=anythingllm:anythingllm ./collector/ ./collector/
|
|
||||||
|
|
||||||
# Install collector dependencies
|
|
||||||
WORKDIR /app/collector
|
WORKDIR /app/collector
|
||||||
ENV PUPPETEER_DOWNLOAD_BASE_URL=https://storage.googleapis.com/chrome-for-testing-public
|
ENV PUPPETEER_DOWNLOAD_BASE_URL=https://storage.googleapis.com/chrome-for-testing-public
|
||||||
RUN yarn install --production --network-timeout 100000 && yarn cache clean
|
RUN yarn install --production --network-timeout 100000 && yarn cache clean
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
FROM base AS production-build
|
||||||
|
WORKDIR /app
|
||||||
|
# Copy the server
|
||||||
|
COPY --chown=anythingllm:anythingllm --from=server-build /app/server/ /app/server/
|
||||||
|
# Copy built static frontend files to the server public directory
|
||||||
|
COPY --chown=anythingllm:anythingllm --from=frontend-build /app/frontend/dist /app/server/public
|
||||||
|
# Copy the collector
|
||||||
|
COPY --chown=anythingllm:anythingllm --from=collector-build /app/collector/ /app/collector/
|
||||||
|
COPY --chown=anythingllm:anythingllm --from=collector-build /app/.cache/puppeteer /app/.cache/puppeteer
|
||||||
|
|
||||||
# Setup the environment
|
# Setup the environment
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
|
Loading…
Reference in New Issue
Block a user