Skip to content

Commit 57ebf45

Browse files
committed
Add Dockerfile
1 parent 3769f6b commit 57ebf45

File tree

71 files changed

+739
-272
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+739
-272
lines changed

.DS_Store

0 Bytes
Binary file not shown.

api-gateway/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## start with a base image
2+
FROM maven:latest
3+
VOLUME /tmp
4+
ARG PROJECT_VERSION=0.0.1
5+
RUN mkdir -p /home/app
6+
WORKDIR /home/app
7+
ENV SPRING_PROFILES_ACTIVE application
8+
COPY ./ .
9+
ADD target/api-gateway-0.0.1-SNAPSHOT.jar api-gateway-0.0.1-SNAPSHOT.jar
10+
EXPOSE 8888
11+
ENTRYPOINT ["java", "-jar", "api-gateway-0.0.1-SNAPSHOT.jar"]
12+
CMD ["mvn", "spring-boot:run"]

api-gateway/docker-compose

Whitespace-only changes.

discovery-service/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## start with a base image
2+
FROM maven:latest
3+
VOLUME /tmp
4+
ARG PROJECT_VERSION=0.0.1
5+
RUN mkdir -p /home/app
6+
WORKDIR /home/app
7+
ENV SPRING_PROFILES_ACTIVE application
8+
COPY ./ .
9+
ADD target/discovery-service-0.0.1-SNAPSHOT.jar discovery-service-0.0.1-SNAPSHOT.jar
10+
EXPOSE 8888
11+
ENTRYPOINT ["java", "-jar", "discovery-service-0.0.1-SNAPSHOT.jar"]
12+
CMD ["mvn", "spring-boot:run"]

discovery-service/docker-compose

Whitespace-only changes.

favourite-service/Dockerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
FROM openjdk:17
2-
ARG PROJECT_VERSION=0.1.0
1+
## start with a base image
2+
FROM maven:latest
3+
VOLUME /tmp
4+
ARG PROJECT_VERSION=0.0.1
35
RUN mkdir -p /home/app
46
WORKDIR /home/app
57
ENV SPRING_PROFILES_ACTIVE application
68
COPY ./ .
79
ADD target/favourite-service-0.0.1-SNAPSHOT.jar favourite-service-0.0.1-SNAPSHOT.jar
8-
EXPOSE 8800
9-
ENTRYPOINT ["java", "-Dspring.profiles.active=${SPRING_PROFILES_ACTIVE}", "-jar", "favourite-service-0.0.1-SNAPSHOT.jar"]
10+
EXPOSE 8888
11+
ENTRYPOINT ["java", "-jar", "favourite-service-0.0.1-SNAPSHOT.jar"]
12+
CMD ["mvn", "spring-boot:run"]

favourite-service/docker-compose

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
version: '3'
2+
3+
services:
4+
mysql:
5+
image: mysql:latest
6+
environment:
7+
MYSQL_ROOT_PASSWORD: 12042003
8+
MYSQL_DATABASE: favouriteservice
9+
MYSQL_USER: admin
10+
MYSQL_PASSWORD: 12042003
11+
ports:
12+
- "3307:3306"
13+
14+
springboot-app:
15+
image: favourite-service:latest
16+
volumes:
17+
- /tmp
18+
- ./favourite_service_database.sql:/docker-entrypoint-initdb.d/init/sql
19+
environment:
20+
SPRING_PROFILES_ACTIVE: application
21+
SPRING_DATASOURCE_URL: jdbc:mysql://mysql:3306/userservice?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC
22+
SPRING_DATASOURCE_USERNAME: admin
23+
SPRING_DATASOURCE_PASSWORD: 12042003
24+
working_dir: /home/app
25+
ports:
26+
- "8888:8888"
27+
entrypoint: [ "java", "-jar", "favourite-service-0.0.1-SNAPSHOT.jar" ]
28+
depends_on:
29+
- mysql
30+
build:
31+
context: .
32+
args:
33+
PROJECT_VERSION: 0.0.1
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
CREATE TABLE favourites
2+
(
3+
user_id INT NOT NULL,
4+
product_id INT NOT NULL,
5+
like_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
6+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
7+
updated_at TIMESTAMP DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
8+
PRIMARY KEY (user_id, product_id, like_date)
9+
);
10+
11+
12+
INSERT INTO favourites(user_id, product_id)
13+
VALUES (1, 1),
14+
(1, 2),
15+
(2, 2);
16+
Binary file not shown.

inventory-service/Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
## start with a base image
2-
FROM openjdk:17
3-
## volumes
2+
FROM maven:latest
43
VOLUME /tmp
5-
## add the application jar to the container
4+
ARG PROJECT_VERSION=0.0.1
5+
RUN mkdir -p /home/app
6+
WORKDIR /home/app
7+
ENV SPRING_PROFILES_ACTIVE application
8+
COPY ./ .
69
ADD target/inventory-service-0.0.1-SNAPSHOT.jar inventory-service-0.0.1-SNAPSHOT.jar
7-
## extract the application jar entry to the container
10+
EXPOSE 8888
811
ENTRYPOINT ["java", "-jar", "inventory-service-0.0.1-SNAPSHOT.jar"]
12+
CMD ["mvn", "spring-boot:run"]
913

1014

1115

0 commit comments

Comments
 (0)