WilliamOnVoyage/World-of-Warships-Stats-Analysis

View on GitHub
buildspec.yml

Summary

Maintainability
Test Coverage
version: 0.2

phases:
  install:
    runtime-versions:
      docker: 18
      python: 3.7
    commands:
      - nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2&
      - timeout 15 sh -c "until docker info; do echo .; sleep 1; done"
      - echo "[+] Installing dependencies...."
      - pip install -r requirements.txt
  pre_build:
    commands:
      - echo "[+] Running tests..."
      - python -m pytest test/ -v
      - echo "[+] Logging in to Amazon ECR..."
      - $(aws ecr get-login --no-include-email --region $AWS_DEFAULT_REGION)
  build:
    commands:
      - echo "[+] Build started on `date`"
      - echo "[+] Building the Docker image..."
      - docker build -t wows:latest .
      - docker tag wows:latest $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/wows
  post_build:
    commands:
      - echo "[+] Build completed on `date`"
      - echo "[+] Pushing the Docker image.."
      - docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/wows:latest
      - echo "[+] Completed pushing Docker image. Deploying Docker image to AWS Fargate on `date`"
      - printf '[{"name":"WOWS-Service","imageUri":"%s"}]' $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/wows:latest > imagedefinitions.json
artifacts:
  files: imagedefinitions.json