From d1b093ab30eed822febbb23ebfc2293bd8496623 Mon Sep 17 00:00:00 2001 From: iVamp Date: Tue, 24 Oct 2023 20:17:54 +0800 Subject: [PATCH] =?UTF-8?q?CI=20=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 10 ++++++++++ Dockerfile | 13 +------------ main.ts | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f7e2069..857a061 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,3 +1,13 @@ +build-js: + image: node:20 + stage: build + script: + - npm config set registry https://registry.npm.taobao.org/ + - npm install + - npm run build + artifacts: + paths: + - dist/ docker-build: image: docker:latest stage: build diff --git a/Dockerfile b/Dockerfile index 8dd27be..65359ce 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,18 +2,7 @@ FROM node:20 LABEL authors="ivamp" WORKDIR /app - -# 忽略 node_modules 目录 -COPY src /app/src -COPY package.json /app/package.json -COPY .env.example /app/.env.example -COPY main.ts /app/main.ts -COPY tsconfig.json /app/tsconfig.json - - -RUN npm config set registry https://registry.npm.taobao.org/ -RUN npm install -RUN npm run build +ADD ./dist /app EXPOSE 3000 diff --git a/main.ts b/main.ts index c8726e1..df65e28 100644 --- a/main.ts +++ b/main.ts @@ -7,6 +7,6 @@ const port = process.env.PORT || 3000 app.listen(port, () => { console.log(`Server is running at http://0.0.0.0:${port}`) - console.log(`You can visit http://localhost:${port}`) + console.log(`For test, you can visit http://localhost:${port}`) console.log(`Press CTRL-C to stop \n`) }) \ No newline at end of file