Skip to content

Instantly share code, notes, and snippets.

@polaroi8d
Created January 8, 2019 14:38
Show Gist options
  • Save polaroi8d/193e37cf5dd98d10a29b75ef240f0291 to your computer and use it in GitHub Desktop.
Save polaroi8d/193e37cf5dd98d10a29b75ef240f0291 to your computer and use it in GitHub Desktop.
image: docker:latest
services:
- docker:dind
variables:
#not valid, only for tests
DOCKER_DRIVER: overlay
SPRING_PROFILES_ACTIVE: gitlab-ci
OAUTH_REDIRECT_URI: "http://localhost:8091/fitbit-oauth"
DOCKER_REGISTRY: "registry.gitlab.com"
DOCKER_IMAGE_NAME: "registry.gitlab.com/medipredict/user-online-api"
APP_VERSION: UOA.1.0.$CI_COMMIT_REF_SLUG.$CI_PIPELINE_IID
EB_ENV_NAME_PREFIX: uoa
stages:
- test
- docker_build
- eb_staging_deploy
- eb_prod_deploy
buildtest-job:
image: java:openjdk-8
stage: test
script:
- id -u "ci" &>/dev/null || useradd "ci"
- mkdir /home/ci && chown ci /home/ci
- su "ci" -c "./gradlew clean build --stacktrace --info"
variables:
# Instruct Testcontainers to use the daemon of DinD.
DOCKER_HOST: "tcp://docker:2375"
# Improve performance with overlayfs.
DOCKER_DRIVER: overlay2
SERVICES: s3:4572
services:
- name: localstack/localstack
artifacts:
name: "$APP_VERSION"
paths:
- build/reports/tests/test/
- build/libs/
- logs/
- build/resources/
- Dockerrun.aws.json
- Dockerfile
- script/
- .elasticbeanstalk/
when: always
tags:
- medipredict
build-push-docker:
only:
- dev
image: docker:latest
stage: docker_build
variables:
GIT_STRATEGY: none
dependencies:
- buildtest-job
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $DOCKER_REGISTRY
- docker build -t $DOCKER_IMAGE_NAME:$APP_VERSION -t $DOCKER_IMAGE_NAME:latest .
- docker push $DOCKER_IMAGE_NAME:latest
- docker push $DOCKER_IMAGE_NAME:$APP_VERSION
eb-staging-deploy:
only:
- dev
stage: eb_staging_deploy
image: coxauto/aws-ebcli
script:
- chmod 700 script/gitlabci-eb-deploy.sh
- bash script/gitlabci-eb-deploy.sh staging
environment:
name: staging
url: https://staging.medipredict.com
when: on_success
eb-prod-deploy:
only:
- dev
stage: eb_prod_deploy
image: coxauto/aws-ebcli
variables:
GIT_STRATEGY: none
script:
- chmod 700 script/gitlabci-eb-deploy.sh
- bash script/gitlabci-eb-deploy.sh prod
environment:
name: production
url: https://portal.medipredict.com
when: manual
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment