Skip to content

Commit 0aedd27

Browse files
committed
start docker composing the backend, fix health response
1 parent a2665fb commit 0aedd27

File tree

5 files changed

+25
-13
lines changed

5 files changed

+25
-13
lines changed

.dockerignore

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
# Ignore everything
2-
**
3-
4-
# Allow files and folders with a pattern starting with !
5-
!todo-service
6-
!bff
7-
!single-page-application
8-
!grpc
2+
**/node_modules
3+
**/.gradle
4+
**/build

bff/src/main/java/com/headissue/compliance/Health.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import grpc.health.v1.HealthGrpc;
66
import grpc.health.v1.Todo;
77
import io.grpc.ManagedChannel;
8-
import io.grpc.ManagedChannelBuilder;
98
import jakarta.servlet.http.HttpServlet;
109
import jakarta.servlet.http.HttpServletRequest;
1110
import jakarta.servlet.http.HttpServletResponse;
@@ -38,6 +37,6 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t
3837
toDoServiceHealth.add("serving", new JsonPrimitive(toDoServiceServing));
3938
servicesHealth.get("services").getAsJsonArray().add(bffServiceHealth);
4039
servicesHealth.get("services").getAsJsonArray().add(toDoServiceHealth);
41-
response.getWriter().println(bffServiceHealth);
40+
response.getWriter().println(servicesHealth);
4241
}
4342
}

docker-compose.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: "3.9"
2+
services:
3+
bff:
4+
container_name: bff
5+
build:
6+
context: .
7+
dockerfile: bff/Dockerfile
8+
ports:
9+
- "8080:8080"
10+
environment:
11+
TODO_SERVICE_HOST: localhost:8081
12+
todo-service:
13+
container_name: todo-service
14+
build:
15+
context: .
16+
dockerfile: todo-service/Dockerfile
17+
environment:
18+
PORT: 8081

todo-service/.google/cloudbuild.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ substitutions:
99
steps:
1010
- id: build
1111
name: gcr.io/cloud-builders/docker
12-
dir: $_SERVICE_NAME
1312
args:
1413
- build
1514
- -t
1615
- $_IMAGE_NAME:dev
16+
- -f
17+
- $_SERVICE_NAME/Dockerfile
1718
- .
1819

1920
- id: push

todo-service/Dockerfile

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
FROM gradle:7.2.0-jdk17-alpine as gradle
2-
COPY --chown=gradle . /home/app
2+
COPY --chown=gradle todo-service /home/app
33
WORKDIR /home/app
44
RUN gradle assemble --no-daemon
55

6-
7-
86
FROM openjdk:17-jdk-slim
97
COPY --from=gradle /home/app/build/libs/*-all.jar app.jar
108
EXPOSE 8080

0 commit comments

Comments
 (0)