Skip to content

Commit

Permalink
Merge pull request #24 from ZhouYixun/dev
Browse files Browse the repository at this point in the history
save_docker_init
  • Loading branch information
ZhouYixun authored Oct 14, 2021
2 parents 178db74 + b174179 commit de8dd01
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 43 deletions.
84 changes: 64 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
<packaging>jar</packaging>

<properties>
<maven.compiler.source>15</maven.compiler.source>
<maven.compiler.target>15</maven.compiler.target>
<maven.compiler.source>16</maven.compiler.source>
<maven.compiler.target>16</maven.compiler.target>
</properties>

<!-- SpringBoot父依赖,统一约束版本号 -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.11.RELEASE</version>
<version>2.4.11</version>
<relativePath/>
</parent>

Expand Down Expand Up @@ -157,6 +157,50 @@
</dependency>
</dependencies>
</profile>
<profile>
<id>prod</id>
<properties>
<profileActive>prod</profileActive>
</properties>
<dependencies>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>ffmpeg</artifactId>
<version>4.2.2-1.5.3</version>
<classifier>linux-x86_64</classifier>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacpp</artifactId>
<version>1.5.3</version>
<classifier>linux-x86_64</classifier>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>opencv</artifactId>
<version>4.3.0-1.5.3</version>
<classifier>linux-x86_64</classifier>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>openblas</artifactId>
<version>0.3.9-1.5.3</version>
<classifier>linux-x86_64</classifier>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>tesseract</artifactId>
<version>4.1.1-1.5.3</version>
<classifier>linux-x86_64</classifier>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>leptonica</artifactId>
<version>1.79.0-1.5.3</version>
<classifier>linux-x86_64</classifier>
</dependency>
</dependencies>
</profile>
</profiles>

<!-- 镜像加速 -->
Expand All @@ -174,22 +218,22 @@
</repository>
</repositories>

<!-- &lt;!&ndash; 打包构建配置 &ndash;&gt;-->
<!-- <build>-->
<!-- <resources>-->
<!-- <resource>-->
<!-- <directory>src/main/resources</directory>-->
<!-- <filtering>true</filtering>-->
<!-- </resource>-->
<!-- </resources>-->
<!-- &lt;!&ndash; 最终打包的jar包名,使用artifactId &ndash;&gt;-->
<!-- <finalName>${project.artifactId}</finalName>-->
<!-- <plugins>-->
<!-- <plugin>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
<!-- </plugin>-->
<!-- </plugins>-->
<!-- </build>-->
<!-- 打包构建配置 -->
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<!-- 最终打包的jar包名,使用artifactId -->
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
67 changes: 67 additions & 0 deletions src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
FROM ubuntu:bionic-20200311

ENV DEBIAN_FRONTEND=noninteractive

ENV SDK_VERSION=sdk-tools-linux-3859397 \
ANDROID_BUILD_TOOLS_VERSION=31.0.0 \
APPIUM_VERSION=1.22.0 \
ATD_VERSION=1.2

WORKDIR /root

RUN apt-get -qqy update && \
apt-get -qqy --no-install-recommends install \
openjdk-8-jdk \
ca-certificates \
zip \
unzip \
curl \
wget \
libqt5webkit5 \
libgconf-2-4 \
gnupg \
salt-minion \
&& rm -rf /var/lib/apt/lists/*

ENV JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/jre" \
PATH=$PATH:$JAVA_HOME/bin

RUN wget -O java.tar.gz https://download.oracle.com/otn-pub/java/jdk/16.0.2+7/d4a915d82b4c4fbb9bde534da945d746/jdk-16.0.2_linux-x64_bin.tar.gz?AuthParam=1634195311_0d15009c3d955574b75fd6d51664b996 && \
tar zxvf java.tar.gz && rm java.tar.gz && \
chmod a+x -R /root/jdk-16.0.2 && \
chown -R root:root /root/jdk-16.0.2

ARG ANDROID_PLATFORM_VERSION="android-25"
ENV ANDROID_HOME=/root

RUN wget -O tools.zip https://dl.google.com/android/repository/${SDK_VERSION}.zip && \
unzip tools.zip && rm tools.zip && \
chmod a+x -R $ANDROID_HOME && \
chown -R root:root $ANDROID_HOME

ENV PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin

RUN mkdir -p ~/.android && \
touch ~/.android/repositories.cfg && \
echo y | sdkmanager "platform-tools" && \
echo y | sdkmanager "build-tools;$ANDROID_BUILD_TOOLS_VERSION" && \
echo y | sdkmanager "platforms;$ANDROID_PLATFORM_VERSION"

ENV PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools

RUN curl -sL https://deb.nodesource.com/setup_12.x | bash && \
apt-get -qqy install nodejs && \
npm install -g appium@${APPIUM_VERSION} --unsafe-perm=true --allow-root && \
exit 0 && \
npm cache clean && \
apt-get remove --purge -y npm && \
apt-get autoremove --purge -y && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
apt-get clean

ADD /mini /root/
ADD /chromeDriver /root/
ADD /language /root/
ADD /sonic-agent.jar /root/
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
ENTRYPOINT ["/root/jdk-16.0.2/bin/java","-server","-Xmx800M","-Xms800M","-Xmn300M","-Xss256K","-XX:-UseGCOverheadLimit","-XX:+DisableExplicitGC","-XX:SurvivorRatio=1","-XX:LargePageSizeInBytes=128M","-XX:SoftRefLRUPolicyMSPerMB=0","-Djava.security.egd=file:/dev/./urandom","-jar","/root/sonic-agent.jar"]
5 changes: 3 additions & 2 deletions src/main/java/com/sonic/agent/receiver/MsgReceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.sonic.agent.tests.AndroidTests;
import com.sonic.agent.tools.AgentTool;
import com.sonic.agent.tools.GetWebStartPort;
import com.sonic.agent.tools.LocalHostTool;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
Expand All @@ -35,6 +34,8 @@
public class MsgReceiver {
@Value("${spring.version}")
private String version;
@Value("${sonic.agent.host}")
private String host;
@Autowired
private AndroidTests androidTests;
private final Logger logger = LoggerFactory.getLogger(MsgReceiver.class);
Expand All @@ -54,7 +55,7 @@ public void process(JSONObject jsonObject, Channel channel, Message message) {
agentInfo.put("port", GetWebStartPort.getTomcatPort());
agentInfo.put("version", version);
agentInfo.put("systemType", System.getProperty("os.name"));
agentInfo.put("host", LocalHostTool.getHostIp());
agentInfo.put("host", host);
RabbitMQThread.send(agentInfo);
try {
channel.basicAck(deliveryTag, true);
Expand Down
19 changes: 0 additions & 19 deletions src/main/java/com/sonic/agent/tools/LocalHostTool.java

This file was deleted.

1 change: 1 addition & 0 deletions src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ sonic:
folder:
url: http://localhost:8094/api/folder
agent:
host: 127.0.0.1
key: 1
24 changes: 24 additions & 0 deletions src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
server:
port: 7777

spring:
application:
name: apex-agent
rabbitmq:
host: ${RABBITMQ_HOST:localhost}
port: ${RABBITMQ_PORT:5672}
username: ${RABBITMQ_USERNAME:sonic}
password: ${RABBITMQ_PASSWORD:sonic}
virtual-host: ${RABBITMQ_VHOST:sonic}
listener:
simple:
acknowledge-mode: manual
publisher-confirm-type: correlated
publisher-returns: true

sonic:
folder:
url: ${SONIC_FOLDER_URL:http://localhost:8094/api/folder}
agent:
host: ${SONIC_AGENT_HOST:127.0.0.1}
key: ${SONIC_AGENT_KEY}
2 changes: 0 additions & 2 deletions src/main/resources/banner.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@
▀██ ██ ██ ██ █▄██ ██ ██▄
█▄▄▄▄▄█▀ ██▄▄██ ██ ███ ▄▄██▄▄ ██▄▄▄▄█
▀▀▀▀▀ ▀▀▀▀ ▀▀ ▀▀▀ ▀▀▀▀▀▀ ▀▀▀▀

Sonic云测平台 - Agent端

0 comments on commit de8dd01

Please sign in to comment.