BAEL-5479 Pushing a Docker Image to a Private Repository (#12108)
* Add sample application * Add Dockerfile * Format * Add README.md
This commit is contained in:
parent
078f635c45
commit
fdacc2cf6c
33
docker/docker-push-to-private-repo/.gitignore
vendored
Normal file
33
docker/docker-push-to-private-repo/.gitignore
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
HELP.md
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
4
docker/docker-push-to-private-repo/Dockerfile
Normal file
4
docker/docker-push-to-private-repo/Dockerfile
Normal file
@ -0,0 +1,4 @@
|
||||
FROM openjdk:11
|
||||
ARG JAR_FILE=target/*.jar
|
||||
COPY ${JAR_FILE} app.jar
|
||||
ENTRYPOINT ["java","-jar","/app.jar"]
|
1
docker/docker-push-to-private-repo/README.md
Normal file
1
docker/docker-push-to-private-repo/README.md
Normal file
@ -0,0 +1 @@
|
||||
### Relevant Articles:
|
43
docker/docker-push-to-private-repo/pom.xml
Normal file
43
docker/docker-push-to-private-repo/pom.xml
Normal file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.baeldung.docker</groupId>
|
||||
<artifactId>docker</artifactId>
|
||||
<version>0.0.1</version>
|
||||
</parent>
|
||||
<artifactId>push-to-private-repo</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>push-to-private-repo</name>
|
||||
<description>Example application to showcase how to push a docker image to a private repository</description>
|
||||
<properties>
|
||||
<java.version>11</java.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
@ -0,0 +1,12 @@
|
||||
package com.baeldung.docker.push;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class HelloWorldController {
|
||||
@GetMapping("/helloworld")
|
||||
String helloWorld() {
|
||||
return "Hello World!";
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.baeldung.docker.push;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class PushToPrivateRepoApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(PushToPrivateRepoApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1 @@
|
||||
|
@ -28,6 +28,7 @@
|
||||
<module>docker-sample-app</module>
|
||||
<module>docker-caching/single-module-caching</module>
|
||||
<module>docker-caching/multi-module-caching</module>
|
||||
<module>docker-push-to-private-repo</module>
|
||||
</modules>
|
||||
|
||||
</project>
|
||||
|
Loading…
x
Reference in New Issue
Block a user