Skip to content

Instantly share code, notes, and snippets.

@ondrejsika
Last active February 20, 2019 13:26
Show Gist options
  • Save ondrejsika/5bd884b9e6b93c978006ffb74309a95e to your computer and use it in GitHub Desktop.
Save ondrejsika/5bd884b9e6b93c978006ffb74309a95e to your computer and use it in GitHub Desktop.
image: ondrejsika/ci
variables:
COMPOSE_PROJECT_NAME: p$CI_PIPELINE_ID
COMPOSE_FILE: docker-compose.yml:docker-compose-test.yml
stages:
- build
- test
before_script:
- docker login $CI_REGISTRY -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD
build:
stage: build
script:
- docker-compose build
- docker-compose push
test:
stage: test
script:
- docker-compose pull
- docker-compose up --no-build --abort-on-container-exit test
after_script:
- docker-compose down --volumes
version: '3.7'
services:
redis:
image: redis
counter:
build: .
image: reg.istry.cz/ondrej/counter
depends_on:
- redis
labels:
traefik.enable: true
traefik.frontend.rule: Host:counter.127.0.0.1.xip.io
traefik:
image: traefik:alpine
command: |
--web \
--docker \
--docker.watch \
--entryPoints="Name:http Address::80" \
--docker.exposedbydefault=false
ports:
- "80:80"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
version: '3.7'
x-service-template: &service-template
image: debian
command: env
environment: &service-env-template
A: 1
B: 2
services:
service1:
<<: *service-template
environment:
<<: *service-env-template
C: 3a
service2:
<<: *service-template
environment:
<<: *service-env-template
C: 3b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment