Skip to content

Instantly share code, notes, and snippets.

@damsdev1
Created March 8, 2023 17:56
Show Gist options
  • Save damsdev1/725668b5bd67229862a72ed905d977d0 to your computer and use it in GitHub Desktop.
Save damsdev1/725668b5bd67229862a72ed905d977d0 to your computer and use it in GitHub Desktop.
kind: pipeline
type: docker
name: default
steps:
- name: Stop Container
image: docker:dind
volumes:
- name: dockersock
path: /var/run/docker.sock
commands:
- docker stop container_name
- docker rm container_name
when:
status:
- success
- failure
- name: Start Container
image: docker:dind
volumes:
- name: dockersock
path: /var/run/docker.sock
- name: compose
path: /data
commands:
- cd /data/
- docker image prune -a -f
- docker-compose up -d
- docker start container_name
when:
status:
- success
- failure
volumes:
- name: compose
host:
path: /path/to/your/container/folder/with/docker/compose/yml
- name: dockersock
host:
path: /var/run/docker.sock
trigger:
event:
exclude:
- pull_request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment