Browse Source

sopppp

master
esoe 8 months ago
parent
commit
75181907b3
  1. 8
      client-service-teachers/dockerfile
  2. 2
      client-service-teachers/pom.xml
  3. 6
      client-service-teachers/src/main/java/ru/molokoin/clientserviceteachers/controllers/TeachersController.java
  4. 1
      client-service-teachers/src/main/resources/application.properties
  5. 5
      client-service-teachers/src/main/resources/application.yaml
  6. 11
      docker-compose.yaml

8
client-service-teachers/dockerfile

@ -0,0 +1,8 @@ @@ -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

2
client-service-teachers/pom.xml

@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
</parent>
<groupId>ru.molokoin</groupId>
<artifactId>client-service-teachers</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>0.1</version>
<name>client-service-teachers</name>
<description>Demo project for Spring Boot</description>
<properties>

6
client-service-teachers/src/main/java/ru/molokoin/clientserviceteachers/controllers/TeachersController.java

@ -5,11 +5,15 @@ import org.springframework.http.HttpHeaders; @@ -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 { @@ -17,7 +21,7 @@ public class TeachersController {
HttpEntity<String> httpEntity = new HttpEntity<>(headers);
ResponseEntity<String> 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();
}
}

1
client-service-teachers/src/main/resources/application.properties

@ -1 +0,0 @@ @@ -1 +0,0 @@
spring.application.name=client-service-teachers

5
client-service-teachers/src/main/resources/application.yaml

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
server:
port: 8181
spring:
application:
name: client-service-teachers

11
docker-compose.yaml

@ -1,10 +1,18 @@ @@ -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: @@ -24,6 +32,7 @@ services:
ports:
- "5432:5432"
restart: unless-stopped
volumes:
db_tech-services:
external: true

Loading…
Cancel
Save