-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from glenrobson/deploy-docker
Adding an auto build for SAS
- Loading branch information
Showing
4 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM maven:3.6.1-jdk-8 | ||
|
||
RUN mkdir -p /usr/src/app | ||
WORKDIR /usr/src/app | ||
ADD . /usr/src/app | ||
RUN rm -rf data | ||
RUN mvn package | ||
|
||
CMD ["java", "-jar", "target/dependency/jetty-runner.jar", "target/simpleAnnotationStore.war"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
version: 0.2 | ||
|
||
phases: | ||
install: | ||
runtime-versions: | ||
docker: 18 | ||
commands: | ||
- nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay& | ||
- timeout 15 sh -c "until docker info; do echo .; sleep 1; done" | ||
pre_build: | ||
commands: | ||
- echo Logging in to Amazon ECR... | ||
- aws --version | ||
- $(aws ecr get-login --region $AWS_DEFAULT_REGION --no-include-email) | ||
- IMAGE_NAME="SAS" | ||
- REPOSITORY_URI=082101253860.dkr.ecr.eu-west-2.amazonaws.com/simple_annotation_server | ||
- IMAGE_TAG=prod_$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7) | ||
build: | ||
commands: | ||
- echo Build started on `date` | ||
- echo Building the Docker image... | ||
- echo Image_tag $IMAGE_TAG | ||
- docker build -t $REPOSITORY_URI:latest . | ||
- docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG | ||
post_build: | ||
commands: | ||
- echo Build completed on `date` | ||
- echo Pushing the Docker images... | ||
- docker push $REPOSITORY_URI:$IMAGE_TAG | ||
- echo Writing image definitions file... | ||
- printf '[{"name":"eventsContainer","imageUri":"%s"}]' $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json | ||
artifacts: | ||
files: imagedefinitions.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
docker build --rm -t sas:latest . && docker run -v /tmp/data:/usr/src/app/data --rm -p 8888:8080 --name sas sas:latest |