oliverdavies.uk/workspace.yml

69 lines
2 KiB
YAML

workspace('oliverdavies-uk'):
description: Sculpin website for oliverdavies.uk.
attribute('docker'):
registry:
password: "= env('DOCKER_REGISTRY_PASSWORD') ?: ''"
url: ghcr.io
username: "= env('DOCKER_REGISTRY_USERNAME') ?: ''"
repository: ghcr.io/opdavies/oliverdavies-uk-web
command('deploy'):
env:
COMPOSE_PROJECT_NAME: = @('namespace')
exec: |
#!bash(workspace:/tools/deployment)
passthru ansible-playbook deploy.yml
command('disable'):
env:
COMPOSE_PROJECT_NAME: = @('namespace')
exec: |
#!bash(workspace:/)
run docker-compose down
command('docker image build <git_commit>'):
env:
COMPOSE_PROJECT_NAME: = @('namespace')
GIT_COMMIT_SHA: = input.argument('git_commit')
exec: |
#!bash(workspace:/)|@
run docker image build -f tools/docker/images/Dockerfile --target=production -t @('docker.repository'):${GIT_COMMIT_SHA} .
run docker image build -f tools/docker/images/Dockerfile --target=production -t @('docker.repository'):latest .
command('docker image pull <git_commit>'):
env:
COMPOSE_PROJECT_NAME: = @('namespace')
GIT_COMMIT_SHA: = input.argument('git_commit')
exec: |
#!bash(workspace:/)|@
run docker image pull @('docker.repository'):${GIT_COMMIT_SHA}
run docker image pull @('docker.repository'):latest
command('docker image push <git_commit>'):
env:
COMPOSE_PROJECT_NAME: = @('namespace')
GIT_COMMIT_SHA: = input.argument('git_commit')
exec: |
#!bash(workspace:/)|@
echo '@("docker.registry.password")' | run docker login --username='@("docker.registry.username")' --password-stdin '@("docker.registry.url")'
run docker push @('docker.repository'):${GIT_COMMIT_SHA}
run docker push @('docker.repository'):latest
run docker logout '@("docker.registry.url")'
command('enable'):
env:
COMPOSE_PROJECT_NAME: = @('namespace')
exec: |
#!bash(workspace:/)
passthru docker-compose up -d --build
command('ps'):
env:
COMPOSE_PROJECT_NAME: = @('namespace')
exec: |
#!bash(workspace:/)
passthru docker-compose ps