diff --git a/client-service-teachers/dockerfile b/client-service-teachers/dockerfile new file mode 100644 index 0000000..6fc83ec --- /dev/null +++ b/client-service-teachers/dockerfile @@ -0,0 +1,8 @@ +FROM openjdk:17-jdk-alpine +RUN apk update +RUN apk upgrade +COPY target/client-service-teachers-0.1.jar /app/client-service-teachers-0.1.jar +WORKDIR /app +# ENTRYPOINT ["java","-jar","/app/resource-service-api-0.1.jar"] +# docker image build -t resource-service-api:latest . +# docker run -p80:8181 resource-service-api:latest \ No newline at end of file diff --git a/client-service-teachers/pom.xml b/client-service-teachers/pom.xml index 44947b3..6e8318e 100644 --- a/client-service-teachers/pom.xml +++ b/client-service-teachers/pom.xml @@ -10,7 +10,7 @@ ru.molokoin client-service-teachers - 0.0.1-SNAPSHOT + 0.1 client-service-teachers Demo project for Spring Boot diff --git a/client-service-teachers/src/main/java/ru/molokoin/clientserviceteachers/controllers/TeachersController.java b/client-service-teachers/src/main/java/ru/molokoin/clientserviceteachers/controllers/TeachersController.java index ed3d323..ee2fbbc 100644 --- a/client-service-teachers/src/main/java/ru/molokoin/clientserviceteachers/controllers/TeachersController.java +++ b/client-service-teachers/src/main/java/ru/molokoin/clientserviceteachers/controllers/TeachersController.java @@ -5,11 +5,15 @@ import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; @RestController +@RequestMapping(path = "/") public class TeachersController { + @GetMapping("/teachers") public String info(){ RestTemplate restTemplate = new RestTemplate(); HttpHeaders headers = new HttpHeaders(); @@ -17,7 +21,7 @@ public class TeachersController { HttpEntity httpEntity = new HttpEntity<>(headers); ResponseEntity response = - restTemplate.exchange("http://resource-service-api:8181/teacher", HttpMethod.GET, httpEntity, String.class); + restTemplate.exchange("http://resource-service-api:8181/teacher/list", HttpMethod.GET, httpEntity, String.class); return response.getBody(); } } diff --git a/client-service-teachers/src/main/resources/application.properties b/client-service-teachers/src/main/resources/application.properties deleted file mode 100644 index 3a15960..0000000 --- a/client-service-teachers/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ -spring.application.name=client-service-teachers diff --git a/client-service-teachers/src/main/resources/application.yaml b/client-service-teachers/src/main/resources/application.yaml new file mode 100644 index 0000000..144628c --- /dev/null +++ b/client-service-teachers/src/main/resources/application.yaml @@ -0,0 +1,5 @@ +server: + port: 8181 +spring: + application: + name: client-service-teachers diff --git a/docker-compose.yaml b/docker-compose.yaml index 8d44588..3704e0f 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,10 +1,18 @@ version: "3" services: + client-service-teachers: + build: client-service-teachers/ + command: ["java","-jar","/app/client-service-teachers-0.1.jar"] + ports: + - 80:8181 + depends_on: + - resource-service-api + resource-service-api: build: resource-service-api/ command: ["java","-jar","/app/resource-service-api-0.1.jar"] ports: - - 80:8181 + - 81:8181 depends_on: - postgres-service @@ -24,6 +32,7 @@ services: ports: - "5432:5432" restart: unless-stopped + volumes: db_tech-services: external: true