Last active
March 9, 2023 21:26
-
-
Save evilj0e/66a550359ec3b11fe9f95c9d16c9a29f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: gitlab/dind | |
stages: | |
- build | |
- deploy | |
build: | |
stage: build | |
script: | |
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com | |
- docker run -v ${PWD}:/work fpco/stack-build bash -c 'cd /work && stack setup && stack install && /root/.local/bin/blog build' | |
- docker build -t registry.gitlab.com/<you>/<image name> . | |
- docker push registry.gitlab.com/<you>/<image name> | |
deploy: | |
stage: deploy | |
environment: production | |
script: | |
- apt-get update -y && apt-get install sshpass -y | |
- chmod -x ./deploy.sh | |
- sh ./deploy.sh $PASS $CI_BUILD_TOKEN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sshpass -p $1 ssh -o StrictHostKeyChecking=no [email protected] << ENDSSH | |
docker login -u gitlab-ci-token -p $2 registry.gitlab.com | |
docker stop <image name> | |
docker rm <image name> | |
docker pull registry.gitlab.com/<you>/<image name> | |
docker run --name <image name> -p 80:80 -d registry.gitlab.com/<you>/<image name> | |
ENDSSH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment