-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDockerfile
42 lines (33 loc) · 1.5 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
# syntax=docker/dockerfile:experimental
FROM debian:8 as jdk
ARG ZULU_REPO_VER=1.0.0-2
RUN apt-get -qq update && \
apt-get -qq -y --no-install-recommends install gnupg software-properties-common locales curl apt-transport-https ca-certificates && \
locale-gen en_US.UTF-8 && \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0x219BD9C9 && \
curl -sLO https://cdn.azul.com/zulu/bin/zulu-repo_${ZULU_REPO_VER}_all.deb && dpkg -i zulu-repo_${ZULU_REPO_VER}_all.deb && \
apt-get -qq update && \
apt-get -qq -y dist-upgrade && \
mkdir -p /usr/share/man/man1 && \
apt-get -qq -y --no-install-recommends install zulu8-jdk && \
rm -rf /var/lib/apt/lists/* zulu-repo_${ZULU_REPO_VER}_all.deb
ENV JAVA_HOME=/usr/lib/jvm/zulu8-ca-amd64
FROM jdk as build
WORKDIR /workspace/app
COPY mvnw .
COPY .mvn .mvn
COPY pom.xml .
COPY src src
RUN --mount=type=cache,target=/root/.m2 ./mvnw install -DskipTests
RUN mkdir -p target/dependency && (cd target/dependency; jar -xf ../*.jar)
FROM jdk
LABEL org.opencontainers.image.source="https://github.com/purpledobie/todo-list"
ARG DEPENDENCY=/workspace/app/target/dependency
EXPOSE 8080
RUN apt-get update && apt-get install -y --no-install-recommends \
sqlite3 \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build ${DEPENDENCY}/BOOT-INF/lib /app/lib
COPY --from=build ${DEPENDENCY}/META-INF /app/META-INF
COPY --from=build ${DEPENDENCY}/BOOT-INF/classes /app
ENTRYPOINT ["java","-cp","app:app/lib/*","io.pivotal.sporing.todos.TodoListApplication"]