GitLab CI/CD部署详解 - %s'
.gitlab-ci.yml.gitlab-ci.yml
stages:
- build
- test
- deploy
build:
stage: build 拼多多帮助力入口
script:
- docker build -t my-image:latest .
test:
stage: test
script:
- docker run -it --rm my-image:latest /bin/bash
- echo "Test passed" > test_result.txt
deploy:
stage: deploy
script:
- docker tag my-image:latest $(echo $(date +%s) | tr '%s' '%Y')
- docker push $(echo $(date +%s) | tr '%s' '%Y')
- docker pull $(echo $(date +%s) | tr '%s' '%Y')
- docker run -it --rm $(echo $(date +%s) | tr '%s' '%Y') /bin/bash
- echo "Deployment successful" >> deployment_result.txt