37 lines
627 B
YAML
37 lines
627 B
YAML
variables:
|
|
APP_NAME: "surl"
|
|
IMAGE_NAME: "$APP_NAME:$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA"
|
|
DOCKER_FILE_PATH: "./Dockerfile"
|
|
|
|
stages:
|
|
- build
|
|
- clear
|
|
- deploy
|
|
|
|
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:
|
|
- docker run -t -d --name ${APP_NAME} -p 5008:80 ${IMAGE_NAME}
|