1 Commits

Author SHA1 Message Date
typist
10bc8fe7cb feat: add Docker support with multi-stage build and CI/CD workflow
All checks were successful
Build and Push Docker Image / build (push) Successful in 1m42s
- Introduced Dockerfile for multi-stage build process using Node.js and Nginx.
- Added .dockerignore to exclude unnecessary files from Docker context.
- Created nginx.conf for server configuration, including gzip compression and SPA routing.
- Implemented Gitea CI/CD workflow for building and pushing Docker images on version tags.
2025-10-27 22:32:54 +08:00
2 changed files with 9 additions and 8 deletions

View File

@@ -19,16 +19,16 @@ jobs:
- name: 登录到 Gitea Container Registry - name: 登录到 Gitea Container Registry
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: ${{ gitea.server_url }} registry: ${{ secrets.REGISTRY_ENDPOINT }}
username: ${{ gitea.actor }} username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ gitea.token }} password: ${{ secrets.REGISTRY_PASSWORD }}
- name: 提取 Docker 元数据 - name: 提取 Docker 元数据
id: meta id: meta
uses: docker/metadata-action@v5 uses: docker/metadata-action@v5
with: with:
images: | images: |
${{ gitea.server_url }}/${{ gitea.repository_owner }}/litek ${{ secrets.REGISTRY_ENDPOINT }}/${{ github.repository_owner }}/litek
tags: | tags: |
type=semver,pattern={{version}} type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}}.{{minor}}
@@ -42,7 +42,8 @@ jobs:
push: true push: true
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha cache-from: type=local,src=/cache
cache-to: type=gha,mode=max cache-to: type=local,dest=/cache,mode=max
platforms: linux/amd64,linux/arm64 # platforms: linux/amd64,linux/arm64
platforms: linux/amd64

View File

@@ -2,7 +2,7 @@
FROM node:22-alpine AS builder FROM node:22-alpine AS builder
# 安装 pnpm # 安装 pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate RUN npm install -g pnpm
# 设置工作目录 # 设置工作目录
WORKDIR /app WORKDIR /app