测试CI
This commit is contained in:
parent
32cf212c65
commit
cebd517179
|
@ -6,14 +6,8 @@ jobs:
|
|||
Explore-Gitea-Actions:
|
||||
runs-on: server
|
||||
steps:
|
||||
- run: echo "The job was automatically triggered by a ${{ gitea.event_name }} event."
|
||||
- run: echo "This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
||||
- run: echo "The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
- run: echo "The ${{ gitea.repository }} repository has been cloned to the runner."
|
||||
- run: echo "The workflow is now ready to test your code on the runner."
|
||||
- name: List files in the repository
|
||||
run: |
|
||||
ls ${{ gitea.workspace }}
|
||||
- run: echo "This job's status is ${{ job.status }}."
|
||||
- run: docker build --pull --rm -f "Dockerfile" -t website-v1:latest "."
|
||||
- run: docker rm -f website-v1 || true
|
||||
- run: docker run -d -p 19555:80 --restart=unless-stopped --name website-v1 website-v1
|
||||
- run: docker rmi $(docker images -f "dangling=true" -q) || true
|
||||
- run: docker ps
|
||||
|
|
39
Dockerfile
39
Dockerfile
|
@ -1,20 +1,35 @@
|
|||
FROM node:lts-alpine3.17
|
||||
FROM node:21 AS build
|
||||
# 容器内的目录,通常我们会使用 app 目录
|
||||
WORKDIR /app
|
||||
# 拷贝项目文件到容器/app下
|
||||
COPY . .
|
||||
|
||||
RUN mkdir -p /web
|
||||
# ARG env_file
|
||||
|
||||
COPY . /web
|
||||
|
||||
WORKDIR /web
|
||||
|
||||
RUN npm config set registry https://registry.npm.taobao.org
|
||||
# RUN npm config set registry https://mirrors.tuna.tsinghua.edu.cn/npm
|
||||
RUN npm install -g pnpm
|
||||
# RUN pnpm config set registry https://mirrors.tuna.tsinghua.edu.cn/npm
|
||||
# 下载编译
|
||||
RUN pnpm i
|
||||
RUN pnpm build
|
||||
# RUN rm -rf node_module
|
||||
# RUN pnpm build
|
||||
RUN pnpm generate
|
||||
# RUN yarn build
|
||||
# RUN yarn generate
|
||||
|
||||
ENV HOST 0.0.0.0
|
||||
ENV PORT 3000
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["pnpm", "start"]
|
||||
# nginx默认暴露80端口
|
||||
FROM nginx
|
||||
|
||||
# 更换工作目录到nginx服务目录下
|
||||
WORKDIR /usr/share/nginx/html
|
||||
|
||||
# 删除服务下可能存在的无用项目
|
||||
RUN rm -rf ./*
|
||||
|
||||
# 复制自定义的 Nginx 配置文件
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# 拷贝打包的文件
|
||||
COPY --from=build /app/dist .
|
||||
|
|
Loading…
Reference in New Issue