Procházet zdrojové kódy

:whale: 在 Docker 中运行,修改dockerfile

冷冷 před 7 roky
rodič
revize
4c83784a74

+ 15 - 3
docker-compose.yml

@@ -25,6 +25,7 @@ services:
   pigx-gateway:
     links:
       - pigx-eureka
+      - pigx-redis
     build:
       context: ./
       dockerfile: ./pigx-gateway/Dockerfile
@@ -40,8 +41,6 @@ services:
       context: ./
       dockerfile: ./pigx-auth/Dockerfile
     restart: always
-    ports:
-      - 3000:3000
 
   pigx-upms:
     links:
@@ -56,6 +55,7 @@ services:
   pigx-monitor:
     links:
       - pigx-eureka
+      - pigx-redis
     build:
       context: ./
       dockerfile: ./pigx-visual/pigx-monitor/Dockerfile
@@ -66,6 +66,7 @@ services:
   pigx-daemon:
     links:
       - pigx-eureka
+      - pigx-redis
     build:
       context: ./
       dockerfile: ./pigx-visual/pigx-daemon/Dockerfile
@@ -76,9 +77,20 @@ services:
   pigx-codegen:
     links:
       - pigx-eureka
+      - pigx-redis
     build:
       context: ./
       dockerfile: ./pigx-visual/pigx-codegen/Dockerfile
     restart: always
+
+  pigx-tx-manager:
+    links:
+      - pigx-eureka
+      - pigx-redis
+    build:
+      context: ./
+      dockerfile: ./pigx-visual/pigx-tx-manager/Dockerfile
+    restart: always
     ports:
-      - 5003:5003
+      - 5004:5004
+      - 9998:9998

+ 1 - 1
pigx-auth/Dockerfile

@@ -8,6 +8,6 @@ WORKDIR /pigx/bin/com.pig4cloud/pigx-auth
 
 EXPOSE 3000
 
-ADD ./target/pigx-auth.jar ./
+ADD ./pigx-auth/target/pigx-auth.jar ./
 
 CMD java -Djava.security.egd=file:/dev/./urandom -jar pigx-auth.jar

+ 1 - 1
pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PigxResourceServerConfigurerAdapter.java

@@ -30,7 +30,7 @@ import org.springframework.security.oauth2.provider.token.RemoteTokenServices;
  * @author lengleng
  * @date 2018/6/22
  */
-public abstract class PigxResourceServerConfigurerAdapter extends ResourceServerConfigurerAdapter {
+public abstract class BaseResourceServerConfigurerAdapter extends ResourceServerConfigurerAdapter {
 	@Autowired
 	protected ResourceAuthExceptionEntryPoint resourceAuthExceptionEntryPoint;
 	@Autowired

+ 1 - 1
pigx-config/Dockerfile

@@ -8,6 +8,6 @@ WORKDIR /pigx/bin/com.pig4cloud/pigx-config
 
 EXPOSE 4001
 
-ADD ./target/pigx-config.jar ./
+ADD ./pigx-config/target/pigx-config.jar ./
 
 CMD java -Djava.security.egd=file:/dev/./urandom -jar pigx-config.jar

+ 1 - 1
pigx-eureka/Dockerfile

@@ -8,6 +8,6 @@ WORKDIR /pigx/bin/com.pig4cloud/pigx-eureka
 
 EXPOSE 1025
 
-ADD ./target/pigx-eureka.jar ./
+ADD ./pigx-eureka/target/pigx-eureka.jar ./
 
 CMD java -Djava.security.egd=file:/dev/./urandom -jar pigx-eureka.jar

+ 1 - 1
pigx-gateway/Dockerfile

@@ -8,6 +8,6 @@ WORKDIR /pigx/bin/com.pig4cloud/pigx-gateway
 
 EXPOSE 9999
 
-ADD ./target/pigx-gateway.jar ./
+ADD ./pigx-gateway/target/pigx-gateway.jar ./
 
 CMD java -Djava.security.egd=file:/dev/./urandom -jar pigx-gateway.jar

+ 58 - 0
pigx-gateway/src/main/java/com/pig4cloud/pigx/gateway/filter/PreviewGatewayFilter.java

@@ -0,0 +1,58 @@
+/*
+ *    Copyright (c) 2018-2025, lengleng All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
+ */
+
+package com.pig4cloud.pigx.gateway.filter;
+
+import cn.hutool.core.util.StrUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.cloud.gateway.filter.GatewayFilter;
+import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.server.reactive.ServerHttpRequest;
+import org.springframework.http.server.reactive.ServerHttpResponse;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author lengleng
+ * @date 2018/8/421
+ * 演示环境过滤处理
+ */
+@Slf4j
+@Component
+public class PreviewGatewayFilter extends AbstractGatewayFilterFactory {
+	private static final String TOKEN = "token";
+
+
+	@Override
+	public GatewayFilter apply(Object config) {
+		return (exchange, chain) -> {
+			ServerHttpRequest request = exchange.getRequest();
+
+			// GET,直接向下执行
+			if (StrUtil.equalsIgnoreCase(request.getMethodValue(), HttpMethod.GET.name()) ||
+				StrUtil.containsIgnoreCase(request.getURI().getPath(), TOKEN)) {
+				return chain.filter(exchange);
+			}
+
+			log.warn("演示环境不能操作-> {},{}", request.getMethodValue(), request.getURI().getPath());
+			ServerHttpResponse response = exchange.getResponse();
+			response.setStatusCode(HttpStatus.LOCKED);
+			return response.setComplete();
+		};
+	}
+}

+ 1 - 1
pigx-upms/pigx-upms-biz/Dockerfile

@@ -8,6 +8,6 @@ WORKDIR /pigx/bin/com.pig4cloud/pigx-upms
 
 EXPOSE 4000
 
-ADD ./target/pigx-upms-biz.jar ./
+ADD ./pigx-upms/pigx-upms-biz/target/pigx-upms-biz.jar ./
 
 CMD java -Djava.security.egd=file:/dev/./urandom -jar pigx-upms-biz.jar

+ 1 - 1
pigx-visual/pigx-codegen/Dockerfile

@@ -8,6 +8,6 @@ WORKDIR /pigx/bin/com.pig4cloud/pigx-codegen
 
 EXPOSE 5003
 
-ADD ./target/pigx-codegen.jar ./
+ADD ./pigx-visual/pigx-codegen/target/pigx-codegen.jar ./
 
 CMD java -Djava.security.egd=file:/dev/./urandom -jar pigx-codegen.jar

+ 1 - 1
pigx-visual/pigx-daemon/Dockerfile

@@ -8,6 +8,6 @@ WORKDIR /pigx/bin/com.pig4cloud/pigx-daemon
 
 EXPOSE 5002
 
-ADD ./target/pigx-daemon.jar ./
+ADD ./pigx-visual/pigx-daemon/target/pigx-daemon.jar ./
 
 CMD java -Djava.security.egd=file:/dev/./urandom -jar pigx-daemon.jar

+ 1 - 1
pigx-visual/pigx-monitor/Dockerfile

@@ -8,6 +8,6 @@ WORKDIR /pigx/bin/com.pig4cloud/pigx-monitor
 
 EXPOSE 5001
 
-ADD ./target/pigx-monitor.jar ./
+ADD ./pigx-visual/pigx-monitor/target/pigx-monitor.jar ./
 
 CMD java -Djava.security.egd=file:/dev/./urandom -jar pigx-monitor.jar

+ 14 - 0
pigx-visual/pigx-tx-manager/Dockerfile

@@ -0,0 +1,14 @@
+FROM anapsix/alpine-java:8_server-jre_unlimited
+
+MAINTAINER wangiegie@gmail.com
+
+RUN mkdir -p /pigx/bin/com.pig4cloud/pigx-tx-manager
+
+WORKDIR /pigx/bin/com.pig4cloud/pigx-tx-manager
+
+EXPOSE 5004
+EXPOSE 9998
+
+ADD ./pigx-visual/pigx-tx-manager/target/pigx-tx-manager.jar ./
+
+CMD java -Djava.security.egd=file:/dev/./urandom -jar pigx-tx-manager.jar

+ 3 - 0
pigx-visual/pigx-tx-manager/pom.xml

@@ -73,6 +73,9 @@
 			<plugin>
 				<groupId>org.springframework.boot</groupId>
 				<artifactId>spring-boot-maven-plugin</artifactId>
+				<configuration>
+					<finalName>${project.name}</finalName>
+				</configuration>
 			</plugin>
 		</plugins>
 	</build>