自动工作流
This commit is contained in:
parent
64c4a03241
commit
0c4db31b56
16
.gitea/workflows/docker-build.yml
Normal file
16
.gitea/workflows/docker-build.yml
Normal file
@ -0,0 +1,16 @@
|
||||
name: Docker Build and Push
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
23
Dockerfile
Normal file
23
Dockerfile
Normal file
@ -0,0 +1,23 @@
|
||||
# 使用官方Node.js 18镜像作为基础
|
||||
FROM node:18-alpine
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# 复制package.json和package-lock.json
|
||||
COPY package*.json ./
|
||||
|
||||
# 安装依赖
|
||||
RUN npm install
|
||||
|
||||
# 复制项目文件
|
||||
COPY . .
|
||||
|
||||
# 构建项目
|
||||
RUN npm run build
|
||||
|
||||
# 暴露3000端口
|
||||
EXPOSE 3000
|
||||
|
||||
# 启动生产服务器
|
||||
CMD ["npm", "start"]
|
||||
Loading…
Reference in New Issue
Block a user