我正在烘焙一个在运行时运行Maven任务的Docker镜像。它看起来像这样:
let sphere = SCNSphere(radius: 1)
.
.
.
func setupView() {
// setup the sphere
sphere.segmentCount = 55
// sphere material
sceneMaterial = SCNMaterial()
// setup the sphereNode
sphereNode = SCNNode(geometry: sphere)
sphereNode.position = SCNVector3Make(0, 0, 0)
sphereNode.scale = SCNVector3Make(-1, 1, 1)
let apperture = 75.0
// setup the camera
camera = SCNCamera()
camera.xFov = apperture
camera.zFar = 10000
camera.yFov = apperture
camera.zNear = 0.5
camera.aperture = 1/10
cameraNode.position = SCNVector3Make(0, 0, 0)
cameraNode.camera = camera
// light node
let lightNode = SCNNode()
lightNode.position = SCNVector3Make(0, 0, 0)
// light
let ambientLight = SCNLight()
ambientLight.type = SCNLightTypeAmbient
ambientLight.color = UIColor(white: 0.7, alpha: 1)
lightNode.light = ambientLight
// add top sceneView
topScene.scene = scene
bottomScene.scene = scene
// setup the sceneView
scene.rootNode.addChildNode(sphereNode)
scene.rootNode.addChildNode(cameraNode)
// video reader
let path = NSBundle.mainBundle().pathForResource("tb", ofType: "mp4")
let url = NSURL(fileURLWithPath: path!)
let asset = AVURLAsset(URL: url,options: nil)
let playerItem = AVPlayerItem(asset: asset)
let player = AVPlayer(playerItem: playerItem)
let videoNode = SKVideoNode(AVPlayer: player)
// check the sizes
let size = CGFloat(1000.0)
let spriteScene = SKScene(size: CGSizeMake(size,size))
videoNode.size.width = size
videoNode.size.height = size
spriteScene.addChild(videoNode)
// the image
sceneMaterial.specular.contents = UIColor.whiteColor()
sceneMaterial.doubleSided = true
sceneMaterial.shininess = 1
sceneMaterial.diffuse.contents = spriteScene
sphere.materials = [sceneMaterial]
videoNode.play()
}
在运行时,我正在运行ADD pom.xml /srv
ADD src /srv/src
WORKDIR /srv
RUN mvn dependencies:go-offline scala:testCompile
来运行负载测试实用程序。
我的POM看起来像这样:
mvn gatling:execute
我想要发生的事情是,当我最终运行<project>
<dependencies>
<dependency>
<groupId>io.gatling</groupId>
<artifactId>gatling-core</artifactId>
<version>${gatling.version}</version>
</dependency>
<dependency>
<groupId>io.gatling</groupId>
<artifactId>gatling-http</artifactId>
<version>${gatling.version}</version>
</dependency>
<dependency>
<groupId>io.gatling</groupId>
<artifactId>gatling-app</artifactId>
<version>${gatling.version}</version>
</dependency>
<dependency>
<groupId>io.gatling.highcharts</groupId>
<artifactId>gatling-charts-highcharts</artifactId>
<version>${gatling.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>${scala-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>${gatling-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>execute</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
时,我不想下载任何依赖项,我希望它们都会在构建时刻录到图像中
然而,即使执行mvn gatling:execute
也不能让我一路走来。运行mvn dependencies:go-offline scala:testCompile
仍需要下载更多依赖项。
如何将Maven所需的绝对所有下载到我的Docker镜像中,以便不需要在运行时下载?
答案 0 :(得分:1)
您不一定要使用maven插件运行模拟,对吗?您可以使用maven打包一个包含所有依赖项的jar并从中执行gatling runner。
答案 1 :(得分:0)
您可以使用以下代码下载所有依赖项:mvn dependency:copy-dependencies
在此之后,您将在 ./ target / dependency / 文件夹中提供所有项目的依赖项。