Skip to content

Commit 365fd58

Browse files
author
Luigi Ferrettino
committed
Added build stage to resource server Dockerfile
1 parent a580594 commit 365fd58

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

oauth2-resource-server/Dockerfile

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,32 @@
1+
#### Stage 1: Build the application
2+
FROM openjdk:8-jdk-alpine as build
3+
4+
# Set the current working directory inside the image
5+
WORKDIR /app
6+
7+
# Copy the root pom.xml and the oauth2-resource-server context
8+
RUN mkdir oauth2-resource-server
9+
COPY ./oauth2-resource-server/ ./oauth2-resource-server
10+
COPY ./pom.xml .
11+
12+
# Change de directory inside the oauth2-resource-server folder
13+
WORKDIR /app/oauth2-resource-server
14+
15+
# Enable permissions on Maven executable
16+
RUN chmod u+x ./mvnw
17+
18+
# Package the application .jar
19+
RUN ./mvnw clean package liberty:package-server -Dinclude=runnable
20+
21+
#### Stage 2: A minimal docker image with command to run the app
122
FROM openjdk:8-jre-alpine
223

3-
# Add my app and config
4-
COPY target/oauth2-resource-server.jar ./
24+
# Set root workdir and copy the builded .jar from the previous stage
25+
WORKDIR /
26+
COPY --from=build /app/oauth2-resource-server/target/oauth2-resource-server.jar ./
527

28+
# Expose the 9280/tcp port
629
EXPOSE 9280
730

8-
CMD java -jar oauth2-resource-server.jar
31+
# Run the server when the docker starts
32+
CMD ["java", "-jar", "oauth2-resource-server.jar"]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
mp.jwt.verify.publickey.location=/META-INF/public-key.pem
2-
mp.jwt.verify.issuer=http://localhost:9080
2+
mp.jwt.verify.issuer=http://172.28.1.2:9080

0 commit comments

Comments
 (0)