qingting/.gitlab-ci.yml

47 lines
740 B
YAML

variables:
APP_NAME: "qingting"
IMAGE_NAME: "$APP_NAME:$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA"
DOCKER_FILE_PATH: "./Dockerfile"
stages:
- build
- clear
- deploy
- purge
build:
stage: build
image: docker:latest
services:
- name: docker:dind
tags:
- dockerbase
script:
- ls -a
- docker build -t ${IMAGE_NAME} -f ${DOCKER_FILE_PATH} .
clear:
stage: clear
tags:
- dockerbase
script:
- docker stop ${APP_NAME}
- docker rm ${APP_NAME}
allow_failure: true
deploy:
stage: deploy
tags:
- dockerbase
script:
- ls -a
- docker run -d --name ${APP_NAME} -p 5013:80 ${IMAGE_NAME}
purge:
stage: purge
tags:
- dockerbase
script:
- docker run --rm dns:blog