2

I am developing a micro-service architecture based application using Spring-boot and Angular7 for the front end. What I need to do is to deploy it to a docker I have installed on my AWS ec2 instance using Travis.

What I have done so far is created a travis.yml file

language: java
jdk: oraclejdk8
services:
  - mysql
  - rabbitmq
  - redis-server

before_install:
  - mysql -e 'CREATE DATABASE IF NOT EXISTS mydb;'

image: my-service/aws-cli-docker

variables:
   AWS_ACCESS_KEY_ID: "##########"
   AWS_SECRET_ACCESS_KEY: "##########"

deploy_stage:
  stage: deploy
  environment: Production
  only:
    - master
  script:
    - aws ssm send-command --document-name "AWS-RunShellScript" --instance-ids "i-########" --parameters '{"commands":["sudo docker-compose -f /home/ubuntu/docker-compose.yml up -d --no-deps --build"],"executionTimeout":["3600"]}' --timeout-seconds 600 --region us-east-2

My dockerfile is in the source of the sevice as is as follows:

FROM java:8 
VOLUME /tmp
ADD ./target/myService-0.0.1-SNAPSHOT.jar  my-service.jar
EXPOSE 8081
ENTRYPOINT [ "sh", "-c", "java -Xms64m -Xmx512m -XX:+UseTLAB -XX:+ResizeTLAB -XX:ReservedCodeCacheSize=128m  -XX:+UseCodeCacheFlushing  -jar  /my-service.jar" ]

nd my docker compose file is in the home/ubuntu path on my ec2 instance as follows:

services:
    vehicle-service:
    image: my-service/aws-cli-docker
    ports:
        -8081:8081

I my Travis build works and tests run but there's no deployment or any errors about the docker image. Can someone figure out what I'm missing?

0 Answers0