瀏覽代碼

提交dockers文件

lgy 4 年之前
父節點
當前提交
7c7e593502
共有 2 個文件被更改,包括 10 次插入0 次删除
  1. 6 0
      Dockerfile
  2. 4 0
      src/main/java/com/persagy/controller/HelloWorld.java

+ 6 - 0
Dockerfile

@@ -0,0 +1,6 @@
+#FROM openjdk:8-jdk-alpine 文件下载会出现空指针错误
+FROM java:8
+RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime	&& echo 'Asia/Shanghai' > /etc/timezone
+COPY ./target/*.jar zkt-project-alarm.jar
+ENTRYPOINT ["java", "-jar", "/zkt-project-alarm.jar"]
+EXPOSE 9984

+ 4 - 0
src/main/java/com/persagy/controller/HelloWorld.java

@@ -36,6 +36,10 @@ public class HelloWorld {
 	AlarmInfoCache alarmInfoCache;
 	@Autowired
 	AlarmRecordRepository alarmRecordRepository;
+	@PostMapping("/")
+	public String world(@RequestBody JSONObject jsonObject) throws Exception {
+		return "hello world!";
+	}
 	@PostMapping("/testMesage")
 	public String testMesage(@RequestBody JSONObject jsonObject) throws Exception {
 		NettyMessage nettyMessage = new NettyMessage();