diff --git a/.dockerignore b/.dockerignore index 8f322f0d..2fb73593 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,7 @@ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies -/node_modules +# /node_modules /.pnp .pnp.js @@ -9,7 +9,7 @@ /coverage # next.js -/.next/ +# /.next/ /out/ # production diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index de728587..12e3e120 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -6,23 +6,34 @@ on: - main jobs: - github: + docker: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - - name: Login to github registry - uses: actions-hub/docker/login@master - env: - DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - - - name: Build :latest - if: success() - run: docker build -t weaigc/bingo:latest . - - - name: Push to docker hub :latest - if: success() - uses: actions-hub/docker@master + - + name: Checkout + uses: actions/checkout@v3 + - name: Use Node.js 18 + uses: actions/setup-node@v3 + with: + node-version: 18 + - run: | + npm install + npm run build + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - + name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - + name: Build and push + uses: docker/build-push-action@v4 with: - args: push weaigc/bingo:latest + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: weaigc/bingo:latest diff --git a/.github/workflows/huggingface.yml b/.github/workflows/huggingface.yml index 2287d307..ac5b6072 100644 --- a/.github/workflows/huggingface.yml +++ b/.github/workflows/huggingface.yml @@ -22,5 +22,7 @@ jobs: cd huggingface git config user.name hf4all git config user.email hf4all@gmail.com - git commit -am "auto build" --amend + echo "Last deploy time: $(date)" > DEPLOY_INFO.txt + git add DEPLOY_INFO.txt + git commit -m "auto deploy $(date)" git push https://$HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/$HF_USERNAME/$SPACE_NAME main -f diff --git a/Dockerfile b/Dockerfile index ec0107b1..077a3b26 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,5 @@ FROM node:18 - ARG DEBIAN_FRONTEND=noninteractive ENV BING_HEADER "" @@ -18,19 +17,15 @@ USER user # Set the working directory to the user's home directory WORKDIR $HOME/app -# Install app dependencies -# A wildcard is used to ensure both package.json AND package-lock.json are copied -# where available (npm@5+) -COPY --chown=user package*.json $HOME/app/ - -RUN npm install - # Copy the current directory contents into the container at $HOME/app setting the owner to the user COPY --chown=user . $HOME/app/ -RUN npm run build && rm -rf src +#RUN npm install && npm run build + +RUN rm -rf src ENV PORT 7860 + EXPOSE 7860 CMD npm start diff --git a/src/pages/api/kblob.ts b/src/pages/api/kblob.ts index 6833a1b5..15511fd0 100644 --- a/src/pages/api/kblob.ts +++ b/src/pages/api/kblob.ts @@ -35,7 +35,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) 'x-forwarded-for': headers['x-forwarded-for'], 'user-agent': headers['User-Agent'], cookie: headers['cookie'], - 'Referer': 'https://www.bing.com/search', + Referer: 'https://www.bing.com/search?q=Bing+AI&showconv=1', + 'Sec-Fetch-Dest': 'iframe', ...formData.getHeaders() } }