Commit 8d6cc144 authored by m0rc0m's avatar m0rc0m
Browse files

agrega docker compose

parent 5ac1e087
Pipeline #222 passed with stages
in 3 minutes and 37 seconds
stages:
- build
- deploy
variables:
SERVER_NAME: calcguardias.rlab.be
SERVER_NAME: 10.81.1.238
IMAGE_NAME: calcguardias
TAG: latest
......@@ -28,3 +29,23 @@ build_image:
- docker build -f docker/Dockerfile -t ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${TAG} .
- docker push ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${TAG}
deploy_repo:
stage: deploy
image: docker:stable
variables:
DOCKER_HOST: "ssh://${SERVER_NAME}"
only:
- master
script:
- apk update
- apk upgrade
- apk add python3 python3-dev py-pip build-base libffi-dev libressl-dev libgcc docker-compose git
- apk add --update openssh-client
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- |-
if [[ ! -z `ssh -t ${SERVER_NAME} -p ${PORT} "docker ps | grep \"${IMAGE_NAME}\""` ]]; then
docker-compose -f docker/docker-compose.yml down
docker rmi $(docker images ${CI_REGISTRY_IMAGE}/${IMAGE_NAME} -q)
fi
- docker-compose -f docker/docker-compose.yml down
- docker-compose -f docker/docker-compose.yml up -d
version: '3'
services:
web:
image: ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${TAG}
restart: unless-stopped
read_only: true
ports:
- 80:80
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment