Skip to content

Commit

Permalink
fix: 418 error
Browse files Browse the repository at this point in the history
  • Loading branch information
leafmoes committed Nov 15, 2024
1 parent b3e236b commit de5ba93
Show file tree
Hide file tree
Showing 10 changed files with 873 additions and 882 deletions.
18 changes: 9 additions & 9 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
logs
dist
doc
tmp
node_modules
.vscode
.git
.gitignore
README.md
logs
dist
doc
tmp
node_modules
.vscode
.git
.gitignore
README.md
*.tar.gz
18 changes: 9 additions & 9 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# API 服务使用的端口
PORT = 8787
# API 调用的前缀地址
API_PREFIX = '/'
# 作为调用 API 验证的 API Key
API_KEY = 'dummy_key'
# 向 DDG 发送请求失败的重试次数
MAX_RETRY_COUNT = 3
# 向 DDG 发送请求失败的重试延迟,单位 ms
# API 服务使用的端口
PORT = 8787
# API 调用的前缀地址
API_PREFIX = '/'
# 作为调用 API 验证的 API Key
API_KEY = 'dummy_key'
# 向 DDG 发送请求失败的重试次数
MAX_RETRY_COUNT = 3
# 向 DDG 发送请求失败的重试延迟,单位 ms
RETRY_DELAY = 5000
140 changes: 70 additions & 70 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,70 +1,70 @@
name: Build and Push Docker Image

on:
push:
branches:
- master
paths-ignore:
- 'readme.md'
- 'dist/index.js'
workflow_dispatch:

env:
GHCR_REPO: ghcr.io/leafmoes/ddg-chat
DOCKER_HUB_REPO: leafmoes/ddg-chat

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_PAT }}

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Get short SHA
id: slug
run: echo "::set-output name=sha7::$(echo ${GITHUB_SHA} | cut -c1-7)"

- name: Build and push to GitHub Container Registry
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
file: Dockerfile
push: true
tags: |
${{ env.GHCR_REPO }}:latest
${{ env.GHCR_REPO }}:${{ steps.slug.outputs.sha7 }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build and push to Docker Hub
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
file: Dockerfile
push: true
tags: |
${{ env.DOCKER_HUB_REPO }}:latest
${{ env.DOCKER_HUB_REPO }}:${{ steps.slug.outputs.sha7 }}
cache-from: type=gha
cache-to: type=gha,mode=max
name: Build and Push Docker Image

on:
push:
branches:
- master
paths-ignore:
- 'readme.md'
- 'dist/index.js'
workflow_dispatch:

env:
GHCR_REPO: ghcr.io/leafmoes/ddg-chat
DOCKER_HUB_REPO: leafmoes/ddg-chat

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_PAT }}

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Get short SHA
id: slug
run: echo "::set-output name=sha7::$(echo ${GITHUB_SHA} | cut -c1-7)"

- name: Build and push to GitHub Container Registry
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
file: Dockerfile
push: true
tags: |
${{ env.GHCR_REPO }}:latest
${{ env.GHCR_REPO }}:${{ steps.slug.outputs.sha7 }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build and push to Docker Hub
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
file: Dockerfile
push: true
tags: |
${{ env.DOCKER_HUB_REPO }}:latest
${{ env.DOCKER_HUB_REPO }}:${{ steps.slug.outputs.sha7 }}
cache-from: type=gha
cache-to: type=gha,mode=max
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -171,5 +171,5 @@ dist/README.md

.dev.vars
.wrangler/

.vercel

.vercel
26 changes: 13 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM node:lts-alpine

WORKDIR /app

COPY package*.json ./

RUN npm ci --only=production

COPY . .

EXPOSE 8787

CMD ["npm", "start"]
FROM node:lts-alpine

WORKDIR /app

COPY package*.json ./

RUN npm ci --only=production

COPY . .

EXPOSE 8787

CMD ["npm", "start"]
Loading

0 comments on commit de5ba93

Please sign in to comment.