Skip to content

Commit b05ef3b

Browse files
committed
Merge branch 'release/0.2'
2 parents 5cb24ec + a1ed7e6 commit b05ef3b

File tree

18 files changed

+496
-14
lines changed

18 files changed

+496
-14
lines changed

docker-compose.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: '2.1'
2+
3+
services:
4+
product:
5+
build: product-service
6+
mem_limit: 350m
7+
environment:
8+
- SPRING_PROFILES_ACTIVE=docker
9+
10+
recommendation:
11+
build: recommendation-service
12+
mem_limit: 350m
13+
environment:
14+
- SPRING_PROFILES_ACTIVE=docker
15+
16+
review:
17+
build: review-service
18+
mem_limit: 350m
19+
environment:
20+
- SPRING_PROFILES_ACTIVE=docker
21+
22+
product-composite:
23+
build: product-composite-service
24+
mem_limit: 350m
25+
ports:
26+
- "8080:8080"
27+
environment:
28+
- SPRING_PROFILES_ACTIVE=docker

product-composite-service/Dockerfile

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#### Start of builder image
2+
# ------------------------
3+
# Builder stage to prepare application for final image
4+
FROM openjdk:14-slim-buster as builder
5+
WORKDIR temp
6+
7+
# Could be set to different jar file location
8+
ARG JAR_FILE=target/*.jar
9+
10+
# Copy fat jar file to current image builder
11+
COPY ${JAR_FILE} application.jar
12+
13+
# Extract the jar file layers
14+
RUN java -Djarmode=layertools -jar --enable-preview application.jar extract
15+
#### End of builder stage
16+
17+
#### Start of actual image
18+
# ------------------------
19+
# Build image based on JDK 14 base image, based on latest debian buster OS
20+
FROM openjdk:14-slim-buster
21+
22+
# Set image information, but could be set to different location from command line
23+
ARG IMAGE_VERSION="0.0.1-SNAPSHOT"
24+
ARG IMAGE_NAME="Product Composite Service"
25+
ARG MAINTAINER="Mohamed Taman <[email protected]>"
26+
27+
LABEL version=${IMAGE_VERSION} name=${IMAGE_NAME} maintainer=${MAINTAINER}
28+
29+
# Limiting security access to not user root user
30+
RUN addgroup siriusxi && useradd -g siriusxi -ms /bin/bash taman
31+
32+
# Setting user to current created user
33+
USER taman
34+
35+
# Set working directory to application folder
36+
WORKDIR /home/taman/application
37+
38+
# Copy all layers from builder stage to current image
39+
COPY --from=builder temp/dependencies/ ./
40+
COPY --from=builder temp/snapshot-dependencies/ ./
41+
COPY --from=builder temp/resources/ ./
42+
COPY --from=builder temp/application/ ./
43+
44+
# Expose current application to port 8080
45+
EXPOSE 8080
46+
47+
ARG JAVA_OPTS=""
48+
49+
# Run the application with JVM configs if any
50+
ENTRYPOINT ["bash", "-c", \
51+
"java -server --enable-preview -XX:+UseContainerSupport \
52+
-XX:+AlwaysActAsServerClassMachine -XX:+UseG1GC -XX:+UseStringDeduplication ${JAVA_OPTS} \
53+
org.springframework.boot.loader.JarLauncher ${0} ${@}"]

product-composite-service/pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,9 @@
1414
<name>Product Composite Service</name>
1515
<description>Product Composite Service Spring Boot based project</description>
1616

17+
<properties>
18+
<skip.dockerization>false</skip.dockerization>
19+
<skip.image.build>false</skip.image.build>
20+
</properties>
21+
1722
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"properties": [
3+
{
4+
"name": "app.product-service.host",
5+
"type": "java.lang.String",
6+
"description": "Description for app.product-service.host."
7+
},
8+
{
9+
"name": "app.product-service.port",
10+
"type": "java.lang.Integer",
11+
"description": "Description for app.product-service.port."
12+
},
13+
{
14+
"name": "app.recommendation-service.host",
15+
"type": "java.lang.String",
16+
"description": "Description for app.recommendation-service.host."
17+
},
18+
{
19+
"name": "app.recommendation-service.port",
20+
"type": "java.lang.Integer",
21+
"description": "Description for app.recommendation-service.port."
22+
},
23+
{
24+
"name": "app.review-service.host",
25+
"type": "java.lang.String",
26+
"description": "Description for app.review-service.host."
27+
},
28+
{
29+
"name": "app.review-service.port",
30+
"type": "java.lang.Integer",
31+
"description": "Description for app.review-service.port."
32+
}
33+
] }

product-composite-service/src/main/resources/application.yaml

+24-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,27 @@ app:
3030
port: 9082
3131
review-service:
3232
host: localhost
33-
port: 9083
33+
port: 9083
34+
35+
# This is a docker specific profile properties
36+
# Also profiles could be separated in its owen file
37+
# with file name format of "application-docker.yaml"
38+
---
39+
spring:
40+
profiles: docker
41+
jmx:
42+
enabled: false
43+
44+
server:
45+
port: 8080
46+
47+
app:
48+
product-service:
49+
host: product
50+
port: 8080
51+
recommendation-service:
52+
host: recommendation
53+
port: 8080
54+
review-service:
55+
host: review
56+
port: 8080

product-service/Dockerfile

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#### Start of builder image
2+
# ------------------------
3+
# Builder stage to prepare application for final image
4+
FROM openjdk:14-slim-buster as builder
5+
WORKDIR temp
6+
7+
# Fatjar location, but could be set to different location from command line
8+
ARG JAR_FILE=target/*.jar
9+
10+
# Copy fat jar file to current image builder
11+
COPY ${JAR_FILE} application.jar
12+
13+
# Extract the jar file layers
14+
RUN java -Djarmode=layertools -jar --enable-preview application.jar extract
15+
#### End of builder stage
16+
17+
#### Start of actual image
18+
# ------------------------
19+
# Build image based on JDK 14 base image, based on latest debian buster OS
20+
FROM openjdk:14-slim-buster
21+
MAINTAINER Mohamed Taman <[email protected]>
22+
23+
# Set image information, but could be set to different location from command line
24+
ARG IMAGE_VERSION="0.0.1-SNAPSHOT"
25+
ARG IMAGE_NAME="Product Service"
26+
ARG MAINTAINER="Mohamed Taman <[email protected]>"
27+
28+
LABEL version=${IMAGE_VERSION} name=${IMAGE_NAME} maintainer=${MAINTAINER}
29+
30+
# Limiting security access to not user root user
31+
RUN addgroup siriusxi && useradd -g siriusxi -ms /bin/bash taman
32+
33+
# Setting user to current created user
34+
USER taman
35+
36+
# Set working directory to application folder
37+
WORKDIR /home/taman/application
38+
39+
# Copy all layers from builder stage to current image
40+
COPY --from=builder temp/dependencies/ ./
41+
COPY --from=builder temp/snapshot-dependencies/ ./
42+
COPY --from=builder temp/resources/ ./
43+
COPY --from=builder temp/application/ ./
44+
45+
# Expose current application to port 8080
46+
EXPOSE 8080
47+
48+
ARG JAVA_OPTS=""
49+
50+
# Run the application with JVM configs if any
51+
ENTRYPOINT ["bash", "-c", \
52+
"java -server --enable-preview -XX:+UseContainerSupport \
53+
-XX:+AlwaysActAsServerClassMachine -XX:+UseG1GC -XX:+UseStringDeduplication ${JAVA_OPTS} \
54+
org.springframework.boot.loader.JarLauncher ${0} ${@}"]

product-service/pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,9 @@
1414
<name>Product Service</name>
1515
<description>Product Service Spring Boot based project</description>
1616

17+
<properties>
18+
<skip.dockerization>false</skip.dockerization>
19+
<skip.image.build>false</skip.image.build>
20+
</properties>
21+
1722
</project>

product-service/src/main/resources/application.yaml

+13-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,16 @@ management:
1818
include: "*"
1919
endpoint:
2020
shutdown:
21-
enabled: true
21+
enabled: true
22+
23+
# This is a docker specific profile properties
24+
# Also profiles could be separated in its owen file
25+
# with file name format of "application-docker.yaml"
26+
---
27+
spring:
28+
profiles: docker
29+
jmx:
30+
enabled: false
31+
32+
server:
33+
port: 8080

recommendation-service/Dockerfile

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#### Start of builder image
2+
# ------------------------
3+
# Builder stage to prepare application for final image
4+
FROM openjdk:14-slim-buster as builder
5+
WORKDIR temp
6+
7+
# Could be set to different jar file location
8+
ARG JAR_FILE=target/*.jar
9+
10+
# Copy fat jar file to current image builder
11+
COPY ${JAR_FILE} application.jar
12+
13+
# Extract the jar file layers
14+
RUN java -Djarmode=layertools -jar --enable-preview application.jar extract
15+
#### End of builder stage
16+
17+
#### Start of actual image
18+
# ------------------------
19+
# Build image based on JDK 14 base image, based on latest debian buster OS
20+
FROM openjdk:14-slim-buster
21+
MAINTAINER Mohamed Taman <[email protected]>
22+
23+
# Set image information, but could be set to different location from command line
24+
ARG IMAGE_VERSION="0.0.1-SNAPSHOT"
25+
ARG IMAGE_NAME="Recommendation Service"
26+
ARG MAINTAINER="Mohamed Taman <[email protected]>"
27+
28+
LABEL version=${IMAGE_VERSION} name=${IMAGE_NAME} maintainer=${MAINTAINER}
29+
30+
# Limiting security access to not user root user
31+
RUN addgroup siriusxi && useradd -g siriusxi -ms /bin/bash taman
32+
33+
# Setting user to current created user
34+
USER taman
35+
36+
# Set working directory to application folder
37+
WORKDIR /home/taman/application
38+
39+
# Copy all layers from builder stage to current image
40+
COPY --from=builder temp/dependencies/ ./
41+
COPY --from=builder temp/snapshot-dependencies/ ./
42+
COPY --from=builder temp/resources/ ./
43+
COPY --from=builder temp/application/ ./
44+
45+
# Expose current application to port 8080
46+
EXPOSE 8080
47+
48+
ARG JAVA_OPTS=""
49+
50+
# Run the application with JVM configs if any
51+
ENTRYPOINT ["bash", "-c", \
52+
"java -server --enable-preview -XX:+UseContainerSupport \
53+
-XX:+AlwaysActAsServerClassMachine -XX:+UseG1GC -XX:+UseStringDeduplication ${JAVA_OPTS} \
54+
org.springframework.boot.loader.JarLauncher ${0} ${@}"]

recommendation-service/pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,9 @@
1414
<name>Recommendation Service</name>
1515
<description>Recommendation Service Spring Boot based project</description>
1616

17+
<properties>
18+
<skip.dockerization>false</skip.dockerization>
19+
<skip.image.build>false</skip.image.build>
20+
</properties>
21+
1722
</project>

recommendation-service/src/main/resources/application.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,15 @@ management:
1919
endpoint:
2020
shutdown:
2121
enabled: true
22+
23+
# This is a docker specific profile properties
24+
# Also profiles could be separated in its owen file
25+
# with file name format of "application-docker.yaml"
26+
---
27+
spring:
28+
profiles: docker
29+
jmx:
30+
enabled: false
31+
32+
server:
33+
port: 8080

review-service/Dockerfile

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#### Start of builder image
2+
# ------------------------
3+
# Builder stage to prepare application for final image
4+
FROM openjdk:14-slim-buster as builder
5+
WORKDIR temp
6+
7+
# Could be set to different jar file location
8+
ARG JAR_FILE=target/*.jar
9+
10+
# Copy fat jar file to current image builder
11+
COPY ${JAR_FILE} application.jar
12+
13+
# Extract the jar file layers
14+
RUN java -Djarmode=layertools -jar --enable-preview application.jar extract
15+
#### End of builder stage
16+
17+
#### Start of actual image
18+
# ------------------------
19+
# Build image based on JDK 14 base image, based on latest debian buster OS
20+
FROM openjdk:14-slim-buster
21+
MAINTAINER Mohamed Taman <[email protected]>
22+
23+
# Set image information, but could be set to different location from command line
24+
ARG IMAGE_VERSION="0.0.1-SNAPSHOT"
25+
ARG IMAGE_NAME="Review Service"
26+
ARG MAINTAINER="Mohamed Taman <[email protected]>"
27+
28+
LABEL version=${IMAGE_VERSION} name=${IMAGE_NAME} maintainer=${MAINTAINER}
29+
30+
# Limiting security access to not user root user
31+
RUN addgroup siriusxi && useradd -g siriusxi -ms /bin/bash taman
32+
33+
# Setting user to current created user
34+
USER taman
35+
36+
# Set working directory to application folder
37+
WORKDIR /home/taman/application
38+
39+
# Copy all layers from builder stage to current image
40+
COPY --from=builder temp/dependencies/ ./
41+
COPY --from=builder temp/snapshot-dependencies/ ./
42+
COPY --from=builder temp/resources/ ./
43+
COPY --from=builder temp/application/ ./
44+
45+
# Expose current application to port 8080
46+
EXPOSE 8080
47+
48+
ARG JAVA_OPTS=""
49+
50+
# Run the application with JVM configs if any
51+
ENTRYPOINT ["bash", "-c", \
52+
"java -server --enable-preview -XX:+UseContainerSupport \
53+
-XX:+AlwaysActAsServerClassMachine -XX:+UseG1GC -XX:+UseStringDeduplication ${JAVA_OPTS} \
54+
org.springframework.boot.loader.JarLauncher ${0} ${@}"]

review-service/pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,9 @@
1414
<name>Review Service</name>
1515
<description>Review Service Spring Boot based project</description>
1616

17+
<properties>
18+
<skip.dockerization>false</skip.dockerization>
19+
<skip.image.build>false</skip.image.build>
20+
</properties>
21+
1722
</project>

0 commit comments

Comments
 (0)