diff --git a/.github/workflows/crontab_cache_to_dockerhub.yml b/.github/workflows/crontab_cache_to_dockerhub.yml index a0164149c..17efc24a5 100644 --- a/.github/workflows/crontab_cache_to_dockerhub.yml +++ b/.github/workflows/crontab_cache_to_dockerhub.yml @@ -28,6 +28,13 @@ jobs: uses: docker/build-push-action@v4 with: context: . - file: cache.Dockerfile + file: cache.install.Dockerfile + push: true + tags: sijinhui/chatgpt-next-web:installcache + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: . + file: cache.build.Dockerfile push: true tags: sijinhui/chatgpt-next-web:buildcache diff --git a/Dockerfile b/Dockerfile index 327739ecd..91607cbd6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,27 +1,32 @@ -FROM sijinhui/chatgpt-next-web:buildcache AS deps - -WORKDIR /app - -COPY package.json yarn.lock ./ - -RUN yarn install - -FROM sijinhui/node:base AS builder - -RUN apk add --no-cache git libc6-compat - -ENV OPENAI_API_KEY="" -ENV GOOGLE_API_KEY="" -ENV CODE="" +#FROM sijinhui/chatgpt-next-web:installcache AS deps +# +#WORKDIR /app +# +#COPY package.json yarn.lock ./ +# +#RUN yarn install +# +#FROM sijinhui/node:base AS builder +# +#RUN apk add --no-cache git libc6-compat +# +#ENV OPENAI_API_KEY="" +#ENV GOOGLE_API_KEY="" +#ENV CODE="" +# +#WORKDIR /app +#COPY . . +#COPY --from=deps /app/node_modules ./node_modules +## 避免下面那个报错 +## RUN mkdir -p "/app/node_modules/tiktoken" && mkdir -p "/app/node_modules/sharp" +## RUN yarn add sharp +## ENV NEXT_SHARP_PATH /app/node_modules/sharp +#RUN yarn build +FROM sijinhui/chatgpt-next-web:buildcache as builder WORKDIR /app COPY . . -COPY --from=deps /app/node_modules ./node_modules -# 避免下面那个报错 -# RUN mkdir -p "/app/node_modules/tiktoken" && mkdir -p "/app/node_modules/sharp" -# RUN yarn add sharp -# ENV NEXT_SHARP_PATH /app/node_modules/sharp -RUN yarn build +RUN yarn install && yarn build FROM sijinhui/node:base AS runner WORKDIR /app diff --git a/cache.build.Dockerfile b/cache.build.Dockerfile new file mode 100644 index 000000000..45420424e --- /dev/null +++ b/cache.build.Dockerfile @@ -0,0 +1,18 @@ +FROM sijinhui/chatgpt-next-web:installcache AS deps + +FROM sijinhui/node:base AS builder + +RUN apk add --no-cache git libc6-compat + +ENV OPENAI_API_KEY="" +ENV GOOGLE_API_KEY="" +ENV CODE="" + +WORKDIR /app +COPY . . +COPY --from=deps /app/node_modules ./node_modules +# 避免下面那个报错 +# RUN mkdir -p "/app/node_modules/tiktoken" && mkdir -p "/app/node_modules/sharp" +# RUN yarn add sharp +# ENV NEXT_SHARP_PATH /app/node_modules/sharp +RUN yarn build diff --git a/cache.Dockerfile b/cache.install.Dockerfile similarity index 100% rename from cache.Dockerfile rename to cache.install.Dockerfile