Skip to content

Commit

Permalink
Merge pull request #49 from yanghun0070/feature/dockerbuild-uaa
Browse files Browse the repository at this point in the history
Add Dockerfile to UAA service
  • Loading branch information
yanghun0070 authored Dec 19, 2020
2 parents 92d870d + eceafde commit 1b80f51
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 6 deletions.
6 changes: 6 additions & 0 deletions dayco-uaa/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM adoptopenjdk/openjdk11
MAINTAINER [email protected]
ARG JAR_FILE=build/libs/*.jar
COPY ${JAR_FILE} app.jar
EXPOSE 9999
ENTRYPOINT ["java", "-jar", "/app.jar"]
11 changes: 11 additions & 0 deletions dayco-uaa/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

#이미지를 빌드하는 명령어는 생성할 이미지 명
docker build --tag dayco:1.0 .

# Docker Image 목록
docker images

# 도커이미지 잘 동작하는 지 컨테이너 확인
docker run -p 9999:9999 -it dayco:1.0 /bin/bash

Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Base64;
import java.util.Optional;

import javax.swing.filechooser.FileSystemView;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
Expand All @@ -23,6 +24,9 @@
@RequestMapping("/profile")
public class ProfileController {

@Value("${server.hostname}")
private String hostName;

private Logger logger = LoggerFactory.getLogger(this.getClass());

private final ProfileService profileService;
Expand Down Expand Up @@ -56,6 +60,10 @@ public User change(@RequestBody ProfileDto profileDto) throws Exception {
fileOutputStream.write(decodedBytes);
}
}
return profileService.change(profileDto.getEmail(), profileDto.getPassword(), Optional.of(fileSavedPath));

return profileService.change(profileDto.getEmail(), profileDto.getPassword(),
(StringUtils.isNotEmpty(fileSavedPath)) ?
Optional.of(hostName + File.pathSeparator + fileSavedPath) :
Optional.empty());
}
}
1 change: 1 addition & 0 deletions dayco-uaa/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
server:
port: 9999
hostname: http://localhost:9999
error:
whitelabel:
enabled: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ public void testUser() throws Exception {
.header("Authorization", authorizationHeader))
.andDo(print())
.andExpect(status().isOk())
.andExpect(jsonPath("$.userId").value("username"))
.andExpect(jsonPath("$.password").isNotEmpty())
.andExpect(jsonPath("$.userAuthorizations").isArray())
.andExpect(jsonPath("$.userAuthorizations[0].roleName").value("USER"));
.andExpect(jsonPath("$.userId").value("username"));
}

@Test
Expand Down

0 comments on commit 1b80f51

Please sign in to comment.