build_prod:
  cmd: docker build
  force_rm: true
  tags:
    - registry: &REGISTRY docker-registry.dun.fh
      image: &IMAGE_NAME findmypast/usher
      tag: latest
    - registry: *REGISTRY
      image: *IMAGE_NAME
      tag: <%=version%>

fast_tests:
  cmd: npm test

# docker build
# --force-rm
# --file=Dockerfile.test
# --tag %docker.repository%-test:%teamcity.build.branch%
# .

run_prod:
  cmd: docker run
  environment:
    - node-env=prod
  memory: 256M
  name: usher
  publish:
    - client: 80
      host: 80
    - client: 8080
      host: 8080
  target:
    registry: *REGISTRY,
    image: *IMAGE_NAME,
    tag: test
  container_command: npm test

build:
  cmd: docker build
  force_rm: true
  tags:
    - registry: &REGISTRY docker-registry.dun.fh
      image: &IMAGE_NAME findmypast/usher
      tag: <%=version%>
    - registry: *REGISTRY
      image: *IMAGE_NAME
      tag: latest

push:
  - cmd: docker push
    registry: *REGISTRY
    image: *IMAGE_NAME
    tag: <%=version%>
  - cmd: docker push
    registry: *REGISTRY
    image: *IMAGE_NAME
    tag: latest

test:
  cmd: docker run
  name: usher-test-runner
  remove: true
  target:
    registry: *REGISTRY
    image: *IMAGE_NAME
    tag: latest
  container_command: npm test

publish:
  cmd: docker run
  name: usher-publisher
  environment:
    - NPM_USER=<%=user%>
    - NPM_PASSWORD=<%=password%>
    - NPM_EMAIL=<%=email%>
  remove: true
  target:
    registry: *REGISTRY
    image: *IMAGE_NAME
    tag: latest
  container_command: npm run publish-to-npm

Define CI steps in YAML
Define CI steps in YAML
