Skip to content

Instantly share code, notes, and snippets.

@luxflux
Created May 23, 2017 13:54
Show Gist options
  • Save luxflux/4fe0ad530c9691c71db1903b1c3af57e to your computer and use it in GitHub Desktop.
Save luxflux/4fe0ad530c9691c71db1903b1c3af57e to your computer and use it in GitHub Desktop.
---
resources:
- name: postgres
type: docker-image
source:
repository: postgres
tag: 9.6.2-alpine
- name: ruby
type: docker-image
source:
repository: ruby
tag: 2.3.4
- name: dcind-image
type: docker-image
source:
repository: amidos/dcind
jobs:
- name: Tests
plan:
- aggregate:
- get: code
trigger: true
- get: postgres
params: {save: true}
- get: ruby
params: {save: true}
- get: dcind-image
- task: Run Tests
image: dcind-image
privileged: true
config:
platform: linux
inputs:
- name: code
- name: postgres
- name: ruby
run:
path: sh
args:
- -exc
- |
source /docker-lib.sh
start_docker
# Strictly speaking, preloading of the image is not required. However you might want it for a couple of reasons:
# - If the image is from a private repository, it is much easier to let concourse pull it, and then pass it through to the task.
# - When the image is passed to the task, Concourse can often get the image from its cache.
docker load -i postgres/image
docker tag "$(cat postgres/image-id)" "$(cat postgres/repository):$(cat postgres/tag)"
docker load -i ruby/image
docker tag "$(cat ruby/image-id)" "$(cat ruby/repository):$(cat ruby/tag)"
# This is just to visually check in the log that image have been loaded successfully.
docker images
# Run the tests container and its dependencies.
docker-compose -f code/ci/compose.yml run tests
docker volume ls -q
# Cleanup.
# Not sure that this is required.
# It's quite possible that Concourse is smart enough to clean up the Docker mess itself.
docker-compose -f code/ci/compose.yml down
docker volume rm $(docker volume ls -q)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment