Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

新增国内Dockerfile文件 #3833

Closed
wants to merge 10 commits into from
Closed

新增国内Dockerfile文件 #3833

wants to merge 10 commits into from

Conversation

xieyos
Copy link

@xieyos xieyos commented Jan 12, 2024

新增国内Dockerfile文件

Copy link

vercel bot commented Feb 5, 2024

@xieyos is attempting to deploy a commit to the NextChat Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

github-actions bot commented Feb 5, 2024

Your build has completed!

Preview deployment

@xieyos xieyos closed this Feb 18, 2024
@xieyos xieyos reopened this Feb 18, 2024
@daiaji
Copy link

daiaji commented Feb 27, 2024

FROM node:18-alpine AS base

FROM base AS deps

RUN sed -i 's#dl-cdn.alpinelinux.org#mirrors.aliyun.com#g' /etc/apk/repositories \
    && apk update \
    && apk add --no-cache libc6-compat

WORKDIR /app

COPY package.json yarn.lock ./

RUN yarn config set registry 'https://registry.npmmirror.com'
RUN yarn install

FROM base AS builder

RUN sed -i 's#dl-cdn.alpinelinux.org#mirrors.aliyun.com#g' /etc/apk/repositories \
    && apk update \
    && apk add --no-cache git

ENV OPENAI_API_KEY=""
ENV GOOGLE_API_KEY=""
ENV CODE=""

WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

RUN yarn build

FROM base AS runner
WORKDIR /app

RUN sed -i 's#dl-cdn.alpinelinux.org#mirrors.aliyun.com#g' /etc/apk/repositories \
    && apk update \
    && apk add --no-cache proxychains-ng

ENV PROXY_URL=""
ENV OPENAI_API_KEY=""
ENV GOOGLE_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

EXPOSE 3000

CMD if [ -n "$PROXY_URL" ]; then \
    export HOSTNAME="127.0.0.1"; \
    protocol=$(echo $PROXY_URL | cut -d: -f1); \
    host=$(echo $PROXY_URL | cut -d/ -f3 | cut -d: -f1); \
    port=$(echo $PROXY_URL | cut -d: -f3); \
    conf=/etc/proxychains.conf; \
    echo "strict_chain" > $conf; \
    echo "proxy_dns" >> $conf; \
    echo "remote_dns_subnet 224" >> $conf; \
    echo "tcp_read_time_out 15000" >> $conf; \
    echo "tcp_connect_time_out 8000" >> $conf; \
    echo "localnet 127.0.0.0/255.0.0.0" >> $conf; \
    echo "localnet ::1/128" >> $conf; \
    echo "[ProxyList]" >> $conf; \
    echo "$protocol $host $port" >> $conf; \
    cat /etc/proxychains.conf; \
    proxychains -f $conf node server.js; \
    else \
    node server.js; \
    fi

原版默认就是https://registry.npmmirror.com
但是可以把alpine的源换掉。

@ShinChven
Copy link

这个项目的 CI/CD 是在 GitHub 上跑的,为什么要添加中国源?

https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web/actions

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


The CI/CD of this project is run on GitHub. Why do we need to add Chinese sources?

https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web/actions

@daiaji
Copy link

daiaji commented Feb 28, 2024

这个项目的 CI/CD 是在 GitHub 上跑的,为什么要添加中国源?

https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web/actions

实际上你有时候也会想在本地debug编译之类,比如我。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


The CI/CD of this project is run on GitHub. Why do we need to add Chinese sources?

https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web/actions

In fact, sometimes you also want to debug and compile locally, like me.

@xieyos xieyos closed this Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants