Docker Community Forums

Share and learn in the Docker community.

Error: Invalid or corrupt jarfile /app.jar with spring boot images?

docker

(Dileepyadav) #1

I am using Gitlab CI AutoDev tool for build docker image for spring boot app with MySQL.
project and docker image working fine with windows localhost. but I am deploying the same image from gitlab registry to centos PVS. I getting error as Invalid or corrupt jarfile /app.jar.

 Dockerfile

FROM openjdk:8-jdk-alpine
VOLUME /tmp
ARG JAR_FILE
ADD ${JAR_FILE} TECHLAVIYA.jar
ENTRYPOINT [“java”,"-Djava.security.egd=file:/dev/./urandom","-jar","/TECHLAVIYA.jar"]

docker-compose.yml

version: ‘3’

services:
docker-mysql:
image: mysql:latest
environment:

  • MYSQL_ROOT_PASSWORD=12345
  • MYSQL_DATABASE=TechlaviyaDB
  • MYSQL_PASSWORD=12345

phpmyadmin:
image: phpmyadmin/phpmyadmin
links:

4.0.0

com.techlaviya.lfee
techlaviya
0.0.1-SNAPSHOT
jar

techlaviya
Demo project for Spring Boot

org.springframework.boot spring-boot-starter-parent 1.5.8.RELEASE UTF-8 UTF-8 1.8 com.techlaviya.lfee.TechlaviyaApplication techlaviya org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-data-jpa
<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-devtools</artifactId>
	<scope>runtime</scope>
</dependency>
<dependency>
	<groupId>mysql</groupId>
	<artifactId>mysql-connector-java</artifactId>
	<scope>runtime</scope>
</dependency>
<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-test</artifactId>
	<scope>test</scope>
</dependency>

<dependency>
	<groupId>com.jayway.jsonpath</groupId>
	<artifactId>json-path</artifactId>
	<scope>test</scope>
</dependency>


<dependency>
	<groupId>io.springfox</groupId>
	<artifactId>springfox-swagger2</artifactId>
	<version>2.4.0</version>
</dependency>
<dependency>
	<groupId>io.springfox</groupId>
	<artifactId>springfox-swagger-ui</artifactId>
	<version>2.4.0</version>
</dependency>


<dependency>
	<groupId>io.jsonwebtoken</groupId>
	<artifactId>jjwt</artifactId>
	<version>0.6.0</version>
</dependency>
<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
	<groupId>com.fasterxml.jackson.core</groupId>
	<artifactId>jackson-core</artifactId>
	<version>2.8.9</version>
</dependency>

<dependency>
	<groupId>org.springframework.mobile</groupId>
	<artifactId>spring-mobile-device</artifactId>
</dependency>

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
TECHLAVIYA org.springframework.boot spring-boot-maven-plugin com.spotify dockerfile-maven-plugin 1.3.6 default build push ${docker.image.prefix}/${project.artifactId} target/${project.build.finalName}.jar
	</plugin>
	<!-- end::plugin[] -->
	<plugin>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-dependency-plugin</artifactId>
		<executions>
			<execution>
				<id>unpack</id>
				<phase>package</phase>
				<goals>
					<goal>unpack</goal>
				</goals>
				<configuration>
					<artifactItems>
						<artifactItem>
							<groupId>${project.groupId}</groupId>
							<artifactId>${project.artifactId}</artifactId>
							<version>${project.version}</version>
						</artifactItem>
					</artifactItems>
				</configuration>
			</execution>
		</executions>
	</plugin>
</plugins>