From bb6b720f33a97296b37f6aee03752a7dec2d1880 Mon Sep 17 00:00:00 2001 From: XiaoXice Date: Fri, 21 Nov 2025 14:48:42 +0800 Subject: [PATCH] add gitea action --- .dockerignore | 19 +++++++++++++++++++ .gitea/workflows/docker.yml | 33 +++++++++++++++++++++++++++++++++ Dockerfile | 26 ++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 .dockerignore create mode 100644 .gitea/workflows/docker.yml create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..9941214 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,19 @@ +node_modules +npm-debug.log +.env +.env.* +!.env.example +.git +.gitignore +README.md +Dockerfile +.dockerignore +.nyc_output +coverage +.coverage +*.md +!README.md +.DS_Store +.vscode +.idea +*.log \ No newline at end of file diff --git a/.gitea/workflows/docker.yml b/.gitea/workflows/docker.yml new file mode 100644 index 0000000..114ce67 --- /dev/null +++ b/.gitea/workflows/docker.yml @@ -0,0 +1,33 @@ +name: Build Docker Image + +on: + push: + branches: + - main + - deploy + pull_request: + branches: + - main + - deploy + workflow_dispatch: {} # 手动触发 + +jobs: + build-image: + # 这里的标签要和你 act_runner 的 labels 一致 + # 如果你在 config.yaml 里用的是 ubuntu-latest,就写 ubuntu-latest + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # 如果你只是要在本机打包镜像,不需要 buildx 和任何登录,直接 docker build 即可 + - name: Build Docker image (local only) + run: | + # 镜像名字你可以自行修改,例如 gitea/${GITEA_REPO_NAME}:latest + IMAGE_NAME="XiaoXice/claude-code-usage-dashboard:latest" + echo "Building image ${IMAGE_NAME} ..." + docker build -t "${IMAGE_NAME}" . + + echo "Built images:" + docker images "${IMAGE_NAME}" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1ff06bf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +# Use Bun runtime image +FROM oven/bun:1-alpine + +# Set working directory +WORKDIR /app + +# Copy package files first for better caching +COPY package.json bun.lock* ./ + +# Install dependencies +RUN bun install --frozen-lockfile + +# Copy source code +COPY . . + +# Build the application +RUN bun run build + +# Expose port +EXPOSE 3000 + +# Set environment to production +ENV NODE_ENV=production + +# Start the application +CMD ["bun", "start"] \ No newline at end of file