-
安装docker
1.先删除旧的版本
sudo yum remove docker
docker-client
docker-client-latest
docker-common
docker-latest
docker-latest-logrotate
docker-logrotate
docker-engine
2.安装依赖
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
添加stable的Docker-ce源
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
3.安装docker-ce
sudo yum install docker-ce docker-ce-cli containerd.io
4.启动docker
sudo systemctl start docker -
安装docker-compose
1.下载docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
或者换成比较快的源:
curl -L "https://get.daocloud.io/docker/compose/releases/download/1.27.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
2.给予执行权限
sudo chmod +x /usr/local/bin/docker-compose
3.测试命令
docker-compose --version
docker-compose version 1.23.2, build 1110ad01
更换源:
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://9qfku0yo.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
systemctl restart docker
systemctl daemon-reload
- 安装gitlab-runner
- 在docker里面注册docker
image: node:16.3.0
stages:
- install
- build
- deploy
cache:
key: vitepro
paths:
- node_modules
job_install:
stage: install
tags:
- docker
script:
- npm config set registry http://registry.npm.taobao.org/
- npm install
job_build:
stage: build
tags:
- docker
script:
- npm run build
artifacts:
paths:
- dist/
job_deploy:
stage: deploy
image: docker
tags:
- docker
script:
- echo 'deploy'
- docker build -t jenkinsvue .
- if [ $(docker ps -aq --filter name=myvite-container) ]; then docker rm -f myvite-container;fi
- docker run -d -p 8082:80 --name myvite-container jenkinsvue
job_deploy_oss:
stage: deploy
tags:
- docker
script:
- wget http://gosspublic.alicdn.com/ossutil/1.6.18/ossutil64
- chmod 755 ossutil64
- ./ossutil64 config -e ${endPoint} -i ${accessKeyID} -k ${accessKeySecret} -L CH --loglevel debug -c ~/.ossutilconfig
- ls
- pwd
- ./ossutil64 -c ~/.ossutilconfig cp -r -f dist oss://bucketdem/
when: manual
FROM node:16.3.0 as builder
WORKDIR /app
COPY package.json .
RUN npm install --registry=http://registry.npm.taobao.org
COPY . .
RUN npm run build
FROM nginx:latest
COPY --from=builder /app/dist /usr/share/nginx/html