fix build

This commit is contained in:
sijinhui 2024-08-14 17:00:36 +08:00
parent 63f0d53140
commit ed8c18b635
3 changed files with 48 additions and 32 deletions

View File

@ -0,0 +1,26 @@
name: Monthly Package Cache
on:
workflow_dispatch:
schedule:
- cron: '0 4 1 * *' # 每月1号的凌晨4点
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: cache.Dockerfile
push: true
tags: sijinhui/chatgpt-next-web:buildcache

View File

@ -1,38 +1,8 @@
#FROM registry.cn-hangzhou.aliyuncs.com/sijinhui/node:18-alpine AS base FROM sijinhui/chatgpt-next-web:buildcache as deps
FROM hub.si.icu/library/node:22.1-alpine AS base
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
RUN apk add --no-cache tzdata
#RUN apk add --no-cache \
# vips-dev \
# fftw-dev \
# glib-dev \
# glib \
# expat-dev
# 设置时区环境变量
ENV TZ=Asia/Chongqing
# 更新并安装时区工具
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ENV PRISMA_ENGINES_MIRROR=https://registry.npmmirror.com/-/binary/prisma
FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn config set registry 'https://registry.npmmirror.com'
RUN yarn config set sharp_binary_host "https://cdn.npmmirror.com/binaries/sharp"
RUN yarn config set sharp_libvips_binary_host "https://cdn.npmmirror.com/binaries/sharp-libvips"
#RUN # 清理遗留的缓存
#RUN yarn cache clean
RUN yarn install
FROM base AS builder FROM base AS builder
RUN apk add --no-cache git RUN apk add --no-cache git libc6-compat
ENV OPENAI_API_KEY="" ENV OPENAI_API_KEY=""
ENV GOOGLE_API_KEY="" ENV GOOGLE_API_KEY=""

20
cache.Dockerfile Normal file
View File

@ -0,0 +1,20 @@
FROM hub.si.icu/library/node:22.1-alpine AS base
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
RUN apk add --no-cache tzdata
# 设置时区环境变量
ENV TZ=Asia/Chongqing
# 更新并安装时区工具
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN yarn config set registry 'https://registry.npmmirror.com' ; \
yarn config set sharp_binary_host "https://cdn.npmmirror.com/binaries/sharp" ; \
yarn config set sharp_libvips_binary_host "https://cdn.npmmirror.com/binaries/sharp-libvips"
ENV PRISMA_ENGINES_MIRROR=https://registry.npmmirror.com/-/binary/prisma
FROM base AS deps
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install