-
Notifications
You must be signed in to change notification settings - Fork 12
/
Dockerfile
64 lines (50 loc) · 1.54 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
######################
## build target ##
######################
FROM openjdk:8u212-jdk-alpine3.9 as build
WORKDIR /app
RUN apk --no-cache add bash
COPY gradle/wrapper ./gradle/wrapper
COPY gradlew ./
RUN ./gradlew --no-daemon --version
COPY build.gradle gradle.properties settings.gradle ./
COPY gradle/*.gradle ./gradle/
COPY .git ./.git/
## Build the application fat jar, invalidate only if the source changes
COPY src/main ./src/main
RUN ./gradlew --no-daemon shadowJar
## build the dropwizard client code
COPY swagger-config.json ./
RUN ./gradlew --no-daemon buildClient
## run the static analysis and tests
COPY codenarc.groovy ./
COPY src/test ./src/test
RUN ./gradlew --no-daemon check
## build args required for coveralls reporting
ARG TRAVIS
ARG TRAVIS_JOB_ID
## run code coverage report, send to coveralls when executing in Travis CI
RUN ./gradlew --no-daemon jacocoTestReport coveralls
######################
## package target ##
######################
FROM openjdk:8u212-jre-alpine3.9 as package
## setup env var for the app name
ENV CRATEKUBE_APP dropwizard-groovy-template
## add in files needed at runtime
WORKDIR /app
COPY app.yml entrypoint.sh ./
COPY --from=build /app/build/libs/${CRATEKUBE_APP}-*-all.jar /app/${CRATEKUBE_APP}.jar
ENTRYPOINT ["/app/entrypoint.sh"]
CMD ["server"]
######################
## publish target ##
######################
FROM build as publish
## setup args needed for bintray tasks
ARG APP_VERSION
ARG JFROG_DEPLOY_USER
ARG JFROG_DEPLOY_KEY
ARG BINTRAY_PUBLISH
COPY ci/maven_publish.sh ./
RUN ./maven_publish.sh