Skip to content

Commit 8815122

Browse files
alecharptipsy
authored andcommitted
Reduce final Docker image size (#33)
* Reduce final Docker image size * Fix mispelling and bad parameter name
1 parent e0d7d1d commit 8815122

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

Dockerfile

+18-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
FROM maven:3.5.2-jdk-8-alpine as maven-build
2-
ENV TOKENS=""
32
WORKDIR /app
43
COPY . .
5-
RUN mvn install
6-
CMD java -Dapi-tokens=$TOKENS -jar target/github-profile-summary-1.0-jar-with-dependencies.jar
4+
RUN mvn verify
5+
6+
FROM openjdk:8-jre-alpine
7+
RUN adduser \
8+
-h /var/github-summary \
9+
-D -u 1000 \
10+
ghsum ghsum
11+
12+
USER ghsum
13+
WORKDIR /var/github-summary
14+
15+
ENV TOKENS=""
16+
ENTRYPOINT ["java", "-Dapi-tokens=${TOKENS}", "-jar", "github-profile-summary.jar"]
17+
EXPOSE 7070
18+
19+
COPY --from=maven-build \
20+
--chown=ghsum:ghsum \
21+
/app/target/github-profile-summary-jar-with-dependencies.jar github-profile-summary.jar

pom.xml

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
</dependencies>
6363

6464
<build>
65+
<finalName>${project.artifactId}</finalName>
6566
<plugins>
6667
<plugin>
6768
<groupId>org.jetbrains.kotlin</groupId>

0 commit comments

Comments
 (0)