sudo docker run --detach \
--hostname gitlab.mczaiyun.top \
--publish 443:443 --publish 80:80 --publish 222:22 \
--name gitlab \
--restart always \
--volume /srv/gitlab/config:/etc/gitlab \
--volume /srv/gitlab/logs:/var/log/gitlab \
--volume /srv/gitlab/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest hostname 域名 或 ip
publish 端口映射
restart 重启方式
gitlab/gitlab-ce:latest 镜像名称
volume 目录挂载
sudo docker run -d --name gitlab-runner --restart always \
-v /srv/gitlab-runner/config:/etc/gitlab-runner \
-v /var/run/docker.sock:/var/run/docker.sock \
gitlab/gitlab-runner:latest
docker run --rm -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner register \
--non-interactive \
--executor "docker" \
--docker-image alpine:latest \
--url "http://gitlab.mczaiyun.top/" \
--registration-token "vtizNrFzQKFacsSMxsJX" \
--description "first-register-runner" \
--tag-list "test-cicd1,dockercicd1" \
--run-untagged="true" \
--locked="false" \
--access-level="not_protected"
在runner配置文件中配置docker命令
"/usr/bin/docker:/usr/bin/docker", "/var/run/docker.sock:/var/run/docker.sock"
部署任务
job_deploy:
image: docker
stage: deploy
script:
- docker build -t folive .
- if [ $(docker ps -aq --filter name=mylive-container) ]; then docker rm -f mylive-container;fi
- docker run -d -p 8001:80 --name mylive-container folive
- echo 'deploy docker image success. visit http://8.135.98.62:8001'
when: manual
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
./ossutil64 -c ~/.ossutilconfig cp -r dist oss://fizzz/
配套视频
代码竟然不算字数,我也是醉了啊
我还要凑够200个字,才能发表。说点什么哪,五一在家录视频好辛苦啊,都没人看。
慢慢来吧。