add deployment

This commit is contained in:
Kasper Juul Hermansen 2022-08-14 17:27:44 +02:00
parent 2f69fc5422
commit 280a9786ec
Signed by: kjuulh
GPG Key ID: 0F95C140730F2F23
3 changed files with 40 additions and 0 deletions

View File

@ -9,3 +9,5 @@ scripts:
type: shell type: shell
run_release: run_release:
type: shell type: shell
deploy_release:
type: shell

21
scripts/deploy_release.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
set -e
echo "deploying docker image"
tag="$REGISTRY/$SERVICE:${COMMIT_SHA:0:10}"
echo "pulling deployments repo"
[ ! -d _deployments ] && echo "deployments could not be cloned aborting" && exit 1
git clone "$DEPLOYMENTS" _deployments
mkdir -p "_deployments/$SERVICE"
cp "$TMP/docker-compose.deploy_release.yml" "_deployments/$SERVICE/docker-compose.yml"
cd _deployments
git add . && git commit -m "Added release $SERVICE: ${COMMIT_SHA:0:10}" && git pull && git push

View File

@ -0,0 +1,17 @@
version: '3.7'
services:
{{.service}}:
image: {{.image}}
ports:
- {{.ports}}
env_file: ".env"
restart: always
depends_on:
- db
db:
image: postgres:13.5
restart: always
env_file: ".env"
volumes:
- ./data/postgres:/var/lib/postgresql/data