Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Implement Docker build
iay committed May 12, 2018
1 parent 3b9f7ff commit ba7e720
Showing 3 changed files with 38 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
@@ -0,0 +1,2 @@
.git/
target/
33 changes: 33 additions & 0 deletions Dockerfile
@@ -0,0 +1,33 @@
#
# Dockerfile for inc-validator.
#
# Performed as a two-stage build so that we can use Maven to generate the application
# but not have it (and the things it downloads) clutter up the deployed image.
#

#
# Build the .jar file in a build container.
#
FROM maven:3.5.3-jdk-8 AS build-jar
MAINTAINER Ian Young <ian@iay.org.uk>

WORKDIR /user
COPY pom.xml ./
COPY swagger swagger
COPY src src

RUN mvn --batch-mode \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
clean package

#
# Build the deployable image.
#
FROM openjdk:8-slim
MAINTAINER Ian Young <ian@iay.org.uk>

WORKDIR /user
COPY --from=build-jar /user/target/*.jar .

EXPOSE 8080
CMD ["java", "-jar", "inc-validator-0.0.1-SNAPSHOT.jar"]
3 changes: 3 additions & 0 deletions docker-build
@@ -0,0 +1,3 @@
#!/bin/bash

docker build -t iay/inc-validator .

0 comments on commit ba7e720

Please sign in to comment.