-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
59 lines (43 loc) · 1.6 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
# ---- Build ----
FROM openjdk:8-jdk-alpine3.7 as build
LABEL maintainer="Nathan Guenther <nathang@indiraactive.com>"
WORKDIR /build
# # Install build dependencies
RUN apk --update add --no-cache maven curl git bash openssh openssl python-dev py-pip
# Setup temp ssh key to pull from private git repo
COPY id_fulfilment-platform* ./
RUN mkdir -p /root/.ssh/ && \
chmod 0700 /root/.ssh && \
cat ./id_fulfilment-platform > /root/.ssh/id_rsa && \
chmod 0700 /root/.ssh/id_rsa && \
ssh-keyscan github.com > /root/.ssh/known_hosts
# Import latest script
RUN git clone git@github.com:indira-active/Scripts.git
# Copy remaining src
COPY . /build
# Build java application
RUN mvn clean install -Dmaven.test.skip=true
# Cleanup ssh keys
RUN rm -vf id_fulfilment-platform /root/.ssh/id*
# ---- Test ----
FROM build as test
# TODO: nathang - Can we split out devDependencies with mvn?
# Run tests and generate coverage
ARG CODECOV_TOKEN
RUN mvn clean test jacoco:report
RUN curl -s https://codecov.io/bash > .codecov && \
chmod +x .codecov && \
./.codecov -t $CODECOV_TOKEN
# ---- Release ----
FROM openjdk:8-jdk-alpine3.7 as release
# TODO: nathang - Can we cache runtime dependencies from a base stage?
# Install Runtime dependencies
COPY requirements.txt .
RUN apk --update add --no-cache maven python-dev py-pip && \
pip install -r requirements.txt
WORKDIR /runtime
COPY --from=build /build/target/fulfillment-platform.jar ./target/fulfillment-platform.jar
COPY --from=build /build/Scripts/sync_inventory.py ./Scripts/sync_inventory.py
# Start service
EXPOSE 8089
ENTRYPOINT ["java", "-jar", "./target/fulfillment-platform.jar"]