Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cs_vsofpm
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wuhao
cs_vsofpm
Commits
95682ac8
Commit
95682ac8
authored
May 17, 2023
by
江兵
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cicd
parent
7c2a2388
Pipeline
#3261
passed with stages
in 2 minutes and 44 seconds
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
97 additions
and
0 deletions
+97
-0
.gitlab-ci.yml
.gitlab-ci.yml
+47
-0
Dockerfile_base
Dockerfile_base
+13
-0
Dockerfile_web_dev
Dockerfile_web_dev
+27
-0
docker-compose-dev.yaml
docker-compose-dev.yaml
+10
-0
No files found.
.gitlab-ci.yml
0 → 100644
View file @
95682ac8
variables
:
NANGAO_BASE_IMAGE
:
"
$CI_REGISTRY/nangao-iot/nangao-base"
VS_WEB_IMAGE
:
"
$CI_REGISTRY/nangao-iot/vs-web"
VS_WEB_BASE_IMAGE
:
"
$CI_REGISTRY/nangao-iot/vs-web-base"
vs-base
:
image
:
$NANGAO_BASE_IMAGE
stage
:
build
services
:
-
docker:dind
before_script
:
-
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script
:
-
docker build -f ./Dockerfile_base -t $VS_WEB_BASE_IMAGE .
-
docker push $VS_WEB_BASE_IMAGE
when
:
manual
vs-web-dev
:
image
:
$NANGAO_BASE_IMAGE
stage
:
build
services
:
-
docker:dind
before_script
:
-
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script
:
-
docker build -f ./Dockerfile_web_dev -t "$VS_WEB_IMAGE"-dev .
-
docker push "$VS_WEB_IMAGE"-dev
only
:
changes
:
-
src/**/*
-
config/**/*
#发布到开发环境
deploy_dev
:
stage
:
deploy
image
:
$NANGAO_BASE_IMAGE
services
:
-
docker:dind
before_script
:
-
mkdir -p ~/.ssh
-
eval $(ssh-agent -s)
-
echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
-
ssh-add <(echo "$PRIVATE_KEY")
script
:
-
rsync -Phvz -e "ssh -p 6005" ./docker-compose-dev.yaml root@$DEV_IP:/root/docker-compose/vslp/docker-compose.yaml
-
ssh -p 6005 $DEV_IP 'cd /root/docker-compose/vslp; docker-compose pull vs_web;docker-compose up -d '
Dockerfile_base
0 → 100644
View file @
95682ac8
# 环境
FROM node:19.6.1-alpine3.17 AS build-env
USER root
ENV SRC_HOME=/root/src
RUN mkdir -p $SRC_HOME
# 复制源代码
ADD . $SRC_HOME/
WORKDIR $SRC_HOME/
RUN yarn
\ No newline at end of file
Dockerfile_web_dev
0 → 100644
View file @
95682ac8
# 环境
FROM swr.cn-north-4.myhuaweicloud.com/nangao-iot/vs-web-base AS build-env
USER root
ENV SRC_HOME=/root/src
RUN mkdir -p $SRC_HOME
# 复制源代码
ADD . $SRC_HOME/
WORKDIR $SRC_HOME
RUN yarn
RUN npm run build:dev
# Second stage - build image
FROM nginx
COPY --from=build-env /root/src/dist/ /usr/share/nginx/html/
#设置时区
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' >/etc/timezone
#PORT
ENV SERVER_PORT 80
EXPOSE ${SERVER_PORT}
\ No newline at end of file
docker-compose-dev.yaml
0 → 100644
View file @
95682ac8
version
:
'
2.2'
services
:
vs_web
:
image
:
swr.cn-north-4.myhuaweicloud.com/nangao-iot/vs-web-dev
container_name
:
vs_web
restart
:
always
ports
:
-
"
8999:80"
volumes
:
-
/etc/localtime:/etc/localtime:ro
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment