Docker linux/arm64 support
This commit is contained in:
parent
38b08ff769
commit
9bc12ab6d7
@ -16,13 +16,19 @@
|
||||
|
||||
FROM thingsboard/base
|
||||
|
||||
COPY start-js-executor.sh ${pkg.name}.deb /tmp/
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
COPY start-js-executor.sh ${pkg.name}.deb ${pkg.name}-arm64.deb /tmp/
|
||||
|
||||
RUN chmod a+x /tmp/*.sh \
|
||||
&& mv /tmp/start-js-executor.sh /usr/bin
|
||||
|
||||
RUN yes | dpkg -i /tmp/${pkg.name}.deb
|
||||
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; \
|
||||
then yes | dpkg -i /tmp/${pkg.name}-arm64.deb; \
|
||||
else yes | dpkg -i /tmp/${pkg.name}.deb; \
|
||||
fi
|
||||
RUN rm /tmp/${pkg.name}.deb
|
||||
RUN rm /tmp/${pkg.name}-arm64.deb
|
||||
|
||||
RUN systemctl --no-reload disable --now ${pkg.name}.service > /dev/null 2>&1 || :
|
||||
|
||||
|
||||
@ -21,10 +21,13 @@ let _projectRoot = null;
|
||||
|
||||
|
||||
(async() => {
|
||||
await fse.move(path.join(projectRoot(), 'target', 'thingsboard-js-executor-linux'),
|
||||
await fse.move(path.join(projectRoot(), 'target', 'thingsboard-js-executor-linux-x64'),
|
||||
path.join(targetPackageDir('linux'), 'bin', 'tb-js-executor'),
|
||||
{overwrite: true});
|
||||
await fse.move(path.join(projectRoot(), 'target', 'thingsboard-js-executor-win.exe'),
|
||||
await fse.move(path.join(projectRoot(), 'target', 'thingsboard-js-executor-linux-arm64'),
|
||||
path.join(targetPackageDir('linux'), 'bin-arm64', 'tb-js-executor'),
|
||||
{overwrite: true});
|
||||
await fse.move(path.join(projectRoot(), 'target', 'thingsboard-js-executor-win-x64.exe'),
|
||||
path.join(targetPackageDir('windows'), 'bin', 'tb-js-executor.exe'),
|
||||
{overwrite: true});
|
||||
})();
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
"main": "server.js",
|
||||
"bin": "server.js",
|
||||
"scripts": {
|
||||
"install": "pkg -t node12-linux-x64,node12-win-x64 --out-path ./target . && node install.js",
|
||||
"install": "pkg -t node12-linux-x64,node12-linux-arm64,node12-win-x64 --out-path ./target . && node install.js",
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "nodemon server.js",
|
||||
"start-prod": "NODE_ENV=production nodemon server.js"
|
||||
|
||||
@ -42,6 +42,7 @@
|
||||
<pkg.package.phase>package</pkg.package.phase>
|
||||
<pkg.linux.dist>${project.build.directory}/package/linux</pkg.linux.dist>
|
||||
<pkg.win.dist>${project.build.directory}/package/windows</pkg.win.dist>
|
||||
<docker.push-arm-amd-image.phase>pre-integration-test</docker.push-arm-amd-image.phase>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
63
msa/pom.xml
63
msa/pom.xml
@ -35,6 +35,7 @@
|
||||
<dockerfile.skip>true</dockerfile.skip>
|
||||
<blackBoxTests.skip>true</blackBoxTests.skip>
|
||||
<dockerfile-maven.version>1.4.13</dockerfile-maven.version>
|
||||
<docker.push-arm-amd-image.phase>none</docker.push-arm-amd-image.phase>
|
||||
</properties>
|
||||
|
||||
<modules>
|
||||
@ -58,8 +59,67 @@
|
||||
<module>black-box-tests</module>
|
||||
</modules>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>push-docker-amd-arm-images</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>push-docker-amd-arm-images</name>
|
||||
</property>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>push-latest-docker-amd-arm-images</id>
|
||||
<phase>${docker.push-arm-amd-image.phase}</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>docker</executable>
|
||||
<workingDirectory>${project.build.directory}</workingDirectory>
|
||||
<arguments>
|
||||
<argument>buildx</argument>
|
||||
<argument>build</argument>
|
||||
<argument>-t</argument>
|
||||
<argument>${docker.repo}/${docker.name}:latest</argument>
|
||||
<argument>--platform=linux/amd64,linux/arm64</argument>
|
||||
<argument>-o</argument>
|
||||
<argument>type=registry</argument>
|
||||
<argument>.</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>push-version-docker-amd-arm-images</id>
|
||||
<phase>${docker.push-arm-amd-image.phase}</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>docker</executable>
|
||||
<workingDirectory>${project.build.directory}</workingDirectory>
|
||||
<arguments>
|
||||
<argument>buildx</argument>
|
||||
<argument>build</argument>
|
||||
<argument>-t</argument>
|
||||
<argument>${docker.repo}/${docker.name}:${project.version}</argument>
|
||||
<argument>--platform=linux/amd64,linux/arm64</argument>
|
||||
<argument>-o</argument>
|
||||
<argument>type=registry</argument>
|
||||
<argument>.</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<extensions>
|
||||
<extension>
|
||||
@ -78,5 +138,4 @@
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
@ -38,6 +38,7 @@
|
||||
<docker.name>tb-node</docker.name>
|
||||
<pkg.unixLogFolder>/var/log/${pkg.name}</pkg.unixLogFolder>
|
||||
<pkg.installFolder>/usr/share/${pkg.name}</pkg.installFolder>
|
||||
<docker.push-arm-amd-image.phase>pre-integration-test</docker.push-arm-amd-image.phase>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
144
msa/tb/pom.xml
144
msa/tb/pom.xml
@ -355,6 +355,150 @@
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>push-docker-amd-arm-images</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>push-docker-amd-arm-images</name>
|
||||
</property>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>push-latest-docker-amd-arm-tb-images</id>
|
||||
<phase>pre-integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>docker</executable>
|
||||
<workingDirectory>${project.build.directory}/docker-tb</workingDirectory>
|
||||
<arguments>
|
||||
<argument>buildx</argument>
|
||||
<argument>build</argument>
|
||||
<argument>-t</argument>
|
||||
<argument>${docker.repo}/${tb.docker.name}:latest</argument>
|
||||
<argument>--platform=linux/amd64,linux/arm64</argument>
|
||||
<argument>-o</argument>
|
||||
<argument>type=registry</argument>
|
||||
<argument>.</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>push-version-docker-amd-arm-tb-images</id>
|
||||
<phase>pre-integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>docker</executable>
|
||||
<workingDirectory>${project.build.directory}/docker-tb</workingDirectory>
|
||||
<arguments>
|
||||
<argument>buildx</argument>
|
||||
<argument>build</argument>
|
||||
<argument>-t</argument>
|
||||
<argument>${docker.repo}/${tb.docker.name}:${project.version}</argument>
|
||||
<argument>--platform=linux/amd64,linux/arm64</argument>
|
||||
<argument>-o</argument>
|
||||
<argument>type=registry</argument>
|
||||
<argument>.</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>push-latest-docker-amd-arm-tb-postgres-images</id>
|
||||
<phase>pre-integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>docker</executable>
|
||||
<workingDirectory>${project.build.directory}/docker-postgres</workingDirectory>
|
||||
<arguments>
|
||||
<argument>buildx</argument>
|
||||
<argument>build</argument>
|
||||
<argument>-t</argument>
|
||||
<argument>${docker.repo}/${tb-postgres.docker.name}:latest</argument>
|
||||
<argument>--platform=linux/amd64,linux/arm64</argument>
|
||||
<argument>-o</argument>
|
||||
<argument>type=registry</argument>
|
||||
<argument>.</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>push-version-docker-amd-arm-tb-postgres-images</id>
|
||||
<phase>pre-integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>docker</executable>
|
||||
<workingDirectory>${project.build.directory}/docker-postgres</workingDirectory>
|
||||
<arguments>
|
||||
<argument>buildx</argument>
|
||||
<argument>build</argument>
|
||||
<argument>-t</argument>
|
||||
<argument>${docker.repo}/${tb-postgres.docker.name}:${project.version}</argument>
|
||||
<argument>--platform=linux/amd64,linux/arm64</argument>
|
||||
<argument>-o</argument>
|
||||
<argument>type=registry</argument>
|
||||
<argument>.</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>push-latest-docker-amd-arm-tb-cassandra-images</id>
|
||||
<phase>pre-integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>docker</executable>
|
||||
<workingDirectory>${project.build.directory}/docker-cassandra</workingDirectory>
|
||||
<arguments>
|
||||
<argument>buildx</argument>
|
||||
<argument>build</argument>
|
||||
<argument>-t</argument>
|
||||
<argument>${docker.repo}/${tb-cassandra.docker.name}:latest</argument>
|
||||
<argument>--platform=linux/amd64,linux/arm64</argument>
|
||||
<argument>-o</argument>
|
||||
<argument>type=registry</argument>
|
||||
<argument>.</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>push-version-docker-amd-arm-tb-cassandra-images</id>
|
||||
<phase>pre-integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>docker</executable>
|
||||
<workingDirectory>${project.build.directory}/docker-cassandra</workingDirectory>
|
||||
<arguments>
|
||||
<argument>buildx</argument>
|
||||
<argument>build</argument>
|
||||
<argument>-t</argument>
|
||||
<argument>${docker.repo}/${tb-cassandra.docker.name}:${project.version}</argument>
|
||||
<argument>--platform=linux/amd64,linux/arm64</argument>
|
||||
<argument>-o</argument>
|
||||
<argument>type=registry</argument>
|
||||
<argument>.</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
<repositories>
|
||||
<repository>
|
||||
|
||||
@ -38,6 +38,7 @@
|
||||
<docker.name>tb-coap-transport</docker.name>
|
||||
<pkg.logFolder>/var/log/${pkg.name}</pkg.logFolder>
|
||||
<pkg.installFolder>/usr/share/${pkg.name}</pkg.installFolder>
|
||||
<docker.push-arm-amd-image.phase>pre-integration-test</docker.push-arm-amd-image.phase>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@ -38,6 +38,7 @@
|
||||
<docker.name>tb-http-transport</docker.name>
|
||||
<pkg.logFolder>/var/log/${pkg.name}</pkg.logFolder>
|
||||
<pkg.installFolder>/usr/share/${pkg.name}</pkg.installFolder>
|
||||
<docker.push-arm-amd-image.phase>pre-integration-test</docker.push-arm-amd-image.phase>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@ -38,6 +38,7 @@
|
||||
<docker.name>tb-lwm2m-transport</docker.name>
|
||||
<pkg.logFolder>/var/log/${pkg.name}</pkg.logFolder>
|
||||
<pkg.installFolder>/usr/share/${pkg.name}</pkg.installFolder>
|
||||
<docker.push-arm-amd-image.phase>pre-integration-test</docker.push-arm-amd-image.phase>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@ -38,6 +38,7 @@
|
||||
<docker.name>tb-mqtt-transport</docker.name>
|
||||
<pkg.logFolder>/var/log/${pkg.name}</pkg.logFolder>
|
||||
<pkg.installFolder>/usr/share/${pkg.name}</pkg.installFolder>
|
||||
<docker.push-arm-amd-image.phase>pre-integration-test</docker.push-arm-amd-image.phase>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@ -39,6 +39,7 @@
|
||||
<docker.name>tb-snmp-transport</docker.name>
|
||||
<pkg.logFolder>/var/log/${pkg.name}</pkg.logFolder>
|
||||
<pkg.installFolder>/usr/share/${pkg.name}</pkg.installFolder>
|
||||
<docker.push-arm-amd-image.phase>pre-integration-test</docker.push-arm-amd-image.phase>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@ -16,13 +16,19 @@
|
||||
|
||||
FROM thingsboard/base
|
||||
|
||||
COPY start-web-ui.sh ${pkg.name}.deb /tmp/
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
COPY start-web-ui.sh ${pkg.name}.deb ${pkg.name}-arm64.deb /tmp/
|
||||
|
||||
RUN chmod a+x /tmp/*.sh \
|
||||
&& mv /tmp/start-web-ui.sh /usr/bin
|
||||
|
||||
RUN yes | dpkg -i /tmp/${pkg.name}.deb
|
||||
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; \
|
||||
then yes | dpkg -i /tmp/${pkg.name}-arm64.deb; \
|
||||
else yes | dpkg -i /tmp/${pkg.name}.deb; \
|
||||
fi
|
||||
RUN rm /tmp/${pkg.name}.deb
|
||||
RUN rm /tmp/${pkg.name}-arm64.deb
|
||||
|
||||
RUN systemctl --no-reload disable --now ${pkg.name}.service > /dev/null 2>&1 || :
|
||||
|
||||
|
||||
@ -21,10 +21,13 @@ let _projectRoot = null;
|
||||
|
||||
|
||||
(async() => {
|
||||
await fse.move(path.join(projectRoot(), 'target', 'thingsboard-web-ui-linux'),
|
||||
await fse.move(path.join(projectRoot(), 'target', 'thingsboard-web-ui-linux-x64'),
|
||||
path.join(targetPackageDir('linux'), 'bin', 'tb-web-ui'),
|
||||
{overwrite: true});
|
||||
await fse.move(path.join(projectRoot(), 'target', 'thingsboard-web-ui-win.exe'),
|
||||
await fse.move(path.join(projectRoot(), 'target', 'thingsboard-web-ui-linux-arm64'),
|
||||
path.join(targetPackageDir('linux'), 'bin-arm64', 'tb-web-ui'),
|
||||
{overwrite: true});
|
||||
await fse.move(path.join(projectRoot(), 'target', 'thingsboard-web-ui-win-x64.exe'),
|
||||
path.join(targetPackageDir('windows'), 'bin', 'tb-web-ui.exe'),
|
||||
{overwrite: true});
|
||||
})();
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
"main": "server.js",
|
||||
"bin": "server.js",
|
||||
"scripts": {
|
||||
"install": "pkg -t node12-linux-x64,node12-win-x64 --out-path ./target . && node install.js",
|
||||
"install": "pkg -t node12-linux-x64,node12-linux-arm64,node12-win-x64 --out-path ./target . && node install.js",
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "WEB_FOLDER=./target/web nodemon server.js",
|
||||
"start-prod": "NODE_ENV=production nodemon server.js"
|
||||
|
||||
@ -44,6 +44,7 @@
|
||||
<pkg.package.phase>package</pkg.package.phase>
|
||||
<pkg.linux.dist>${project.build.directory}/package/linux</pkg.linux.dist>
|
||||
<pkg.win.dist>${project.build.directory}/package/windows</pkg.win.dist>
|
||||
<docker.push-arm-amd-image.phase>pre-integration-test</docker.push-arm-amd-image.phase>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@ -36,12 +36,6 @@ ospackage {
|
||||
user pkgUser
|
||||
permissionGroup pkgUser
|
||||
|
||||
// Copy the executable file
|
||||
from("${buildDir}/package/linux/bin/${pkgName}") {
|
||||
fileMode 0500
|
||||
into "bin"
|
||||
}
|
||||
|
||||
// Copy the init file
|
||||
from("${buildDir}/package/linux/init/template") {
|
||||
fileMode 0500
|
||||
@ -78,9 +72,17 @@ buildRpm {
|
||||
preUninstall file("${buildDir}/control/rpm/prerm")
|
||||
postUninstall file("${buildDir}/control/rpm/postrm")
|
||||
|
||||
into pkgInstallFolder
|
||||
|
||||
user pkgUser
|
||||
permissionGroup pkgUser
|
||||
|
||||
// Copy the executable file
|
||||
from("${buildDir}/package/linux/bin/${pkgName}") {
|
||||
fileMode 0500
|
||||
into "bin"
|
||||
}
|
||||
|
||||
// Copy the system unit files
|
||||
from("${buildDir}/control/template.service") {
|
||||
addParentDirs = false
|
||||
@ -111,9 +113,17 @@ buildDeb {
|
||||
preUninstall file("${buildDir}/control/deb/prerm")
|
||||
postUninstall file("${buildDir}/control/deb/postrm")
|
||||
|
||||
into pkgInstallFolder
|
||||
|
||||
user pkgUser
|
||||
permissionGroup pkgUser
|
||||
|
||||
// Copy the executable file
|
||||
from("${buildDir}/package/linux/bin/${pkgName}") {
|
||||
fileMode 0500
|
||||
into "bin"
|
||||
}
|
||||
|
||||
// Copy the system unit files
|
||||
from("${buildDir}/control/template.service") {
|
||||
addParentDirs = false
|
||||
@ -126,3 +136,46 @@ buildDeb {
|
||||
|
||||
link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf")
|
||||
}
|
||||
|
||||
// Same as the buildRpm task
|
||||
task buildDebArm64(type: Deb) {
|
||||
|
||||
arch = "arm64"
|
||||
|
||||
archiveFileName = "${pkgName}-arm64.deb"
|
||||
|
||||
configurationFile("${pkgInstallFolder}/conf/${pkgName}.conf")
|
||||
configurationFile("${pkgInstallFolder}/conf/custom-environment-variables.yml")
|
||||
configurationFile("${pkgInstallFolder}/conf/default.yml")
|
||||
configurationFile("${pkgInstallFolder}/conf/logger.js")
|
||||
|
||||
preInstall file("${buildDir}/control/deb/preinst")
|
||||
postInstall file("${buildDir}/control/deb/postinst")
|
||||
preUninstall file("${buildDir}/control/deb/prerm")
|
||||
postUninstall file("${buildDir}/control/deb/postrm")
|
||||
|
||||
into pkgInstallFolder
|
||||
|
||||
user pkgUser
|
||||
permissionGroup pkgUser
|
||||
|
||||
// Copy the executable file
|
||||
from("${buildDir}/package/linux/bin-arm64/${pkgName}") {
|
||||
fileMode 0500
|
||||
into "bin"
|
||||
}
|
||||
|
||||
// Copy the system unit files
|
||||
from("${buildDir}/control/template.service") {
|
||||
addParentDirs = false
|
||||
fileMode 0644
|
||||
into "/lib/systemd/system"
|
||||
rename { String filename ->
|
||||
"${pkgName}.service"
|
||||
}
|
||||
}
|
||||
|
||||
link("/etc/${pkgName}/conf", "${pkgInstallFolder}/conf")
|
||||
}
|
||||
|
||||
buildDeb.finalizedBy buildDebArm64
|
||||
|
||||
5
pom.xml
5
pom.xml
@ -684,6 +684,11 @@
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>3.0.0-M1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user