Files
ChatGPT-Next-Web/Dockerfile
T
2023-06-16 01:22:08 +08:00

46 lines
1.1 KiB
Docker

FROM rockylinux:8.7 AS base
RUN dnf -y install curl dnf-plugins-core \
&& curl -sL https://rpm.nodesource.com/setup_18.x | bash - \
&& curl -sL https://dl.yarnpkg.com/rpm/yarn.repo -o /etc/yum.repos.d/yarn.repo \
&& dnf -y install nodejs yarn \
&& dnf clean all
FROM base AS deps
WORKDIR /app
COPY package.json yarn.lock ./
# RUN yarn config set registry 'https://registry.npmmirror.com/'
RUN yarn install
FROM base AS dev
# RUN dnf -y install git
ENV OPENAI_API_KEY=""
ENV CODE=""
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
FROM dev AS builder
RUN yarn build
FROM base AS runner
WORKDIR /app
# Install proxychains-ng if needed
# Compile it from source code if it's not available in the repository
ENV PROXY_URL=""
ENV OPENAI_API_KEY=""
ENV CODE=""
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/.next/server ./.next/server
COPY run-app.sh /run-app.sh
RUN chmod +x /run-app.sh
EXPOSE 3000
CMD ["/run-app.sh"]