JAVA-31609 move docker modules out of tutorials repo

This commit is contained in:
Loredana Crusoveanu 2024-03-29 10:07:04 +02:00
parent 788a4abad7
commit 358f60bb59
91 changed files with 0 additions and 1197 deletions

View File

@ -1,3 +0,0 @@
## Relevant Articles:
- [Caching Maven Dependencies with Docker](https://www.baeldung.com/ops/docker-cache-maven-dependencies)

View File

@ -1,21 +0,0 @@
FROM maven:alpine as build
ENV HOME=/usr/app
RUN mkdir -p $HOME
WORKDIR $HOME
ADD pom.xml $HOME
ADD core/pom.xml $HOME/core/pom.xml
ADD runner/pom.xml $HOME/runner/pom.xml
RUN mvn -pl core verify --fail-never
ADD core $HOME/core
RUN mvn -pl core install
RUN mvn -pl runner verify --fail-never
ADD runner $HOME/runner
RUN mvn -pl core,runner package
FROM openjdk:8-jdk-alpine
COPY --from=build /usr/app/runner/target/runner-0.0.1-SNAPSHOT-jar-with-dependencies.jar /app/runner.jar
ENTRYPOINT java -jar /app/runner.jar

View File

@ -1,13 +0,0 @@
FROM maven:alpine as build
ENV HOME=/usr/app
RUN mkdir -p $HOME
WORKDIR $HOME
ADD . $HOME
RUN --mount=type=cache,target=/root/.m2 mvn -f $HOME/pom.xml clean package
FROM openjdk:8-jdk-alpine
COPY --from=build /usr/app/runner/target/runner-0.0.1-SNAPSHOT-jar-with-dependencies.jar /app/runner.jar
ENTRYPOINT java -jar /app/runner.jar

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>core-module</artifactId>
<parent>
<artifactId>multi-module-caching</artifactId>
<groupId>com.baeldung</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<guava.version>33.0.0-jre</guava.version>
</properties>
</project>

View File

@ -1,14 +0,0 @@
package com.baeldung.maven_caching;
import com.google.common.io.Files;
public class CoreClass {
public String method() {
return "Hello from core module!!";
}
public String dependencyMethod() {
return Files.simplifyPath("/home/app/test");
}
}

View File

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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>
<groupId>com.baeldung</groupId>
<artifactId>multi-module-caching</artifactId>
<version>0.0.1-SNAPSHOT</version>
<description>Multi-module Maven caching example</description>
<packaging>pom</packaging>
<modules>
<module>runner-module</module>
<module>core-module</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<properties>
<guava.version>33.0.0-jre</guava.version>
</properties>
</project>

View File

@ -1,57 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>runner-module</artifactId>
<parent>
<artifactId>multi-module-caching</artifactId>
<groupId>com.baeldung</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>com.baeldung</groupId>
<artifactId>core-module</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.baeldung.maven_caching.MavenCachingApplication</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>assemble-all</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
</project>

View File

@ -1,11 +0,0 @@
package com.baeldung.maven_caching;
public class MavenCachingApplication {
public static void main(String[] args) {
CoreClass cc = new CoreClass();
System.out.println(cc.method());
System.out.println(cc.dependencyMethod());
}
}

View File

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>docker-caching</artifactId>
<name>docker-caching</name>
<packaging>pom</packaging>
<parent>
<artifactId>docker-modules</artifactId>
<groupId>com.baeldung</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modules>
<module>single-module-caching</module>
<module>multi-module-caching</module>
</modules>
</project>

View File

@ -1,15 +0,0 @@
FROM maven:alpine as build
ENV HOME=/usr/app
RUN mkdir -p $HOME
WORKDIR $HOME
ADD pom.xml $HOME
RUN mvn verify --fail-never
ADD . $HOME
RUN mvn package
FROM openjdk:8-jdk-alpine
COPY --from=build /usr/app/target/single-module-caching-1.0-SNAPSHOT-jar-with-dependencies.jar /app/runner.jar
ENTRYPOINT java -jar /app/runner.jar

View File

@ -1,13 +0,0 @@
FROM maven:alpine as build
ENV HOME=/usr/app
RUN mkdir -p $HOME
WORKDIR $HOME
ADD . $HOME
RUN --mount=type=cache,target=/root/.m2 mvn -f $HOME/pom.xml clean package
FROM openjdk:8-jdk-alpine
COPY --from=build /usr/app/target/single-module-caching-1.0-SNAPSHOT-jar-with-dependencies.jar /app/runner.jar
ENTRYPOINT java -jar /app/runner.jar

View File

@ -1,55 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.baeldung</groupId>
<artifactId>single-module-caching</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.baeldung.maven_caching.MavenCachingMain</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>assemble-all</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<guava.version>33.0.0-jre</guava.version>
</properties>
</project>

View File

@ -1,11 +0,0 @@
package com.baeldung.maven_caching;
import com.google.common.io.Files;
public class MavenCachingMain {
public static void main(String[] args) {
System.out.println("Hello from maven_caching app!!!");
System.out.println(Files.simplifyPath("/home/app/test"));
}
}

View File

@ -1,2 +0,0 @@
## Relevant Articles:
- [Communicating With Docker Containers on the Same Machine](https://www.baeldung.com/ops/docker-communicating-with-containers-on-same-machine)

View File

@ -1,3 +0,0 @@
FROM alpine:latest
MAINTAINER baeldung.com
RUN apk update && apk add iputils && apk add bash && apk add curl

View File

@ -1,7 +0,0 @@
FROM node:8.16.1-alpine
WORKDIR /app
COPY host_docker_internal/package.json /app
COPY host_docker_internal/index.js /app
RUN npm install
CMD node index.js
EXPOSE 8080

View File

@ -1,20 +0,0 @@
services:
alpine-app-1:
container_name: alpine-app-1
image: alpine-app-1
build:
context: ..
dockerfile: Dockerfile
tty: true
ports:
- 8081:8081
alpine-app-2:
container_name: alpine-app-2
image: alpine-app-2
build:
context: ..
dockerfile: Dockerfile
tty: true
ports:
- 8080:8080

View File

@ -1,29 +0,0 @@
services:
alpine-app-1:
container_name: alpine-app-1
extra_hosts: # for linux hosts since version 20.10
- host.docker.internal:host-gateway
build:
context: ..
dockerfile: Dockerfile
image: alpine-app-1
tty: true
networks:
- first-network
node-app:
container_name: node-app
build:
context: ..
dockerfile: Dockerfile.node
image: node-app
ports:
- 8080:8080
networks:
- second-network
networks:
first-network:
driver: bridge
second-network:
driver: bridge

View File

@ -1,10 +0,0 @@
var express = require('express')
var app = express()
app.get('/', function (req, res) {
res.send('Hello World!')
})
app.listen(8080, function () {
console.log('app listening on port 8080!')
})

View File

@ -1,14 +0,0 @@
{
"name": "host_docker_internal",
"version": "1.0.0",
"description": "node js app",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Baeldung",
"license": "ISC",
"dependencies": {
"express": "^4.18.2"
}
}

View File

@ -1,34 +0,0 @@
services:
alpine-app-1:
container_name: alpine-app-1
build:
context: ..
dockerfile: Dockerfile
image: alpine-app-1
tty: true
ports:
- 8080:8080
networks:
network-example:
ipv4_address: 10.5.0.2
alpine-app-2:
container_name: alpine-app-2
build:
context: ..
dockerfile: Dockerfile
image: alpine-app-2
tty: true
ports:
- 8081:8081
networks:
network-example:
ipv4_address: 10.5.0.3
networks:
network-example:
driver: bridge
ipam:
config:
- subnet: 10.5.0.0/16
gateway: 10.5.0.1

View File

@ -1,36 +0,0 @@
services:
alpine-app-1:
container_name: alpine-app-1
build:
context: ..
dockerfile: Dockerfile
image: alpine-app-1
tty: true
ports:
- 8080:8080
networks:
network-example:
ipv4_address: 192.168.2.2
alpine-app-2:
container_name: alpine-app-2
build:
context: ..
dockerfile: Dockerfile
image: alpine-app-2
tty: true
ports:
- 8081:8081
networks:
network-example:
ipv4_address: 192.168.2.3
networks:
network-example:
driver: macvlan
driver_opts:
parent: enp0s3
ipam:
config:
- subnet: 192.168.2.0/24
gateway: 192.168.2.1

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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>
<artifactId>docker-compose-2</artifactId>
<description>Demo project for Spring Boot and Docker - Module docker-compose-2</description>
<packaging>pom</packaging>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-boot-3</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../parent-boot-3</relativePath>
</parent>
</project>

View File

@ -1,4 +0,0 @@
FROM openjdk:17-alpine
MAINTAINER baeldung.com
COPY target/docker-compose-0.0.1-SNAPSHOT.jar app.jar
ENTRYPOINT ["java","-jar","/app.jar"]

View File

@ -1,10 +0,0 @@
## Relevant Articles:
- [Introduction to Docker Compose](https://www.baeldung.com/ops/docker-compose)
- [How to Get Docker-Compose to Always Use the Latest Image](https://www.baeldung.com/ops/docker-compose-latest-image)
- [Communication Between Multiple Docker Compose Projects](https://www.baeldung.com/ops/docker-compose-communication)
- [Difference Between links and depends_on in Docker Compose](https://www.baeldung.com/ops/docker-compose-links-depends-on)
- [Mounting Multiple Volumes on a Docker Container](https://www.baeldung.com/ops/docker-mounting-multiple-volumes)
- [Rebuild Docker Container in Docker Compose](https://www.baeldung.com/rebuild-docker-container-compose)
- [Assign Static IP to Docker Container and Docker-Compose](https://www.baeldung.com/ops/docker-assign-static-ip-container)
- [Exclude a Sub-Folder When Adding a Volume to Docker](https://www.baeldung.com/ops/docker-exclude-sub-folder-when-adding-volume)

View File

@ -1,27 +0,0 @@
services:
db:
container_name: mysql_db
image: mysql:latest
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_ROOT_HOST=10.5.0.1
ports:
- '3306:3306'
volumes:
- db:/var/lib/mysql
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
networks:
network:
ipv4_address: 10.5.0.5
volumes:
db:
driver: local
networks:
network:
driver: bridge
ipam:
config:
- subnet: 10.5.0.0/16
gateway: 10.5.0.1

View File

@ -1,13 +0,0 @@
CREATE DATABASE IF NOT EXISTS test;
CREATE USER 'db_user'@'10.5.0.1' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'db_user'@'10.5.0.1' WITH GRANT OPTION;
FLUSH PRIVILEGES;
use test;
CREATE TABLE IF NOT EXISTS TEST_TABLE (id int, name varchar(255));
INSERT INTO TEST_TABLE VALUES (1, 'TEST_1');
INSERT INTO TEST_TABLE VALUES (2, 'TEST_2');
INSERT INTO TEST_TABLE VALUES (3, 'TEST_3');

View File

@ -1,14 +0,0 @@
services:
db:
image: postgres:latest
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
ports:
- 5432:5432
web-app:
image: web-app:latest
ports:
- 8080:8080
depends_on:
- db

View File

@ -1,14 +0,0 @@
services:
db:
image: postgres:latest
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
ports:
- 5432:5432
web-app:
image: web-app:latest
ports:
- 8080:8080
links:
- db

View File

@ -1,36 +0,0 @@
services:
db:
image: postgres:latest
restart: always
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
ports:
- 5432:5432
volumes:
- db:/var/lib/postgresql/data
networks:
- mynet
web-app:
image: web-app:latest
depends_on:
- db
networks:
- mynet
ports:
- 8080:8080
environment:
DB_HOST: db
DB_PORT: 5432
DB_USER: postgres
DB_PASSWORD: postgres
DB_NAME: postgres
networks:
mynet:
driver: bridge
volumes:
db:
driver: local

View File

@ -1,7 +0,0 @@
FROM node:12.18.1
ENV NODE_ENV=production
WORKDIR /app
COPY ["package.json", "package-lock.json*", "./"]
RUN npm install --production
COPY . .
CMD [ "node", "server.js" ]

View File

@ -1,12 +0,0 @@
services:
node-app:
build: .
ports:
- 8080:8080
volumes:
- .:/app
- my-vol:/app/node_modules/
volumes:
my-vol:
driver: local

View File

@ -1,17 +0,0 @@
{
"name": "app",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"ronin-mocks": "^0.1.11",
"ronin-server": "^0.1.3"
}
}

View File

@ -1,7 +0,0 @@
const ronin = require('ronin-server')
const mocks = require('ronin-mocks')
const server = ronin.server()
server.use('/', mocks.server(server.Router(), false, true))
server.start()

View File

@ -1,61 +0,0 @@
version: '3'
services:
## VOLUME CONTAINER-TO-CONTAINER AND HOST-TO-CONTAINER TEST ##
volumes-example-service:
image: alpine:latest
container_name: volumes-example-service
volumes:
- /tmp:/my-volumes/host-volume
- /home:/my-volumes/readonly-host-volume:ro
- my-named-global-volume:/my-volumes/named-global-volume
tty: true # Needed to keep the container running
another-volumes-example-service:
image: alpine:latest
container_name: another-volumes-example-service
volumes:
- my-named-global-volume:/another-path/the-same-named-global-volume
tty: true # Needed to keep the container running
## NETWORK CONTAINER-TO-CONTAINER TEST ##
network-example-service:
image: karthequian/helloworld:latest
container_name: network-example-service
networks:
- my-shared-network
another-service-in-the-same-network:
image: alpine:latest
container_name: another-service-in-the-same-network
networks:
- my-shared-network
tty: true # Needed to keep the container running
another-service-in-its-own-network:
image: alpine:latest
container_name: another-service-in-its-own-network
networks:
- my-private-network
tty: true # Needed to keep the container running
## NETWORK HOST-TO-CONTAINER TEST ##
network-example-service-available-to-host-on-port-1337:
image: karthequian/helloworld:latest
container_name: network-example-service-available-to-host-on-port-1337
networks:
- my-shared-network
ports:
- "1337:80"
volumes:
my-named-global-volume:
networks:
my-shared-network: {}
my-private-network: {}

View File

@ -1,3 +0,0 @@
FROM openjdk:11
COPY target/docker-sample-app-0.0.1.jar app.jar
ENTRYPOINT ["java","-jar","/app.jar"]

View File

@ -1,8 +0,0 @@
version: '2.4'
services:
db:
image: postgres
my_app:
build: .
ports:
- "8080:8080"

View File

@ -1,9 +0,0 @@
version: '2.4'
services:
db:
image: postgres
my_app:
image: "eugen/test-app:latest"
ports:
- "8080:8080"

View File

@ -1,15 +0,0 @@
services:
mysql-db:
image: mysql:latest
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_ROOT_HOST=localhost
ports:
- '3306:3306'
volumes:
- first-volume-data:/var/lib/mysql
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
volumes:
first-volume-data:
external: true

View File

@ -1,9 +0,0 @@
CREATE DATABASE IF NOT EXISTS test;
use test;
CREATE TABLE IF NOT EXISTS test_table (id int, description varchar(255));
INSERT INTO test_table VALUES (1, 'TEST_1');
INSERT INTO test_table VALUES (2, 'TEST_2');
INSERT INTO test_table VALUES (3, 'TEST_3');

View File

@ -1,15 +0,0 @@
services:
localstack:
privileged: true
image: localstack/localstack:latest
container_name: localstack
ports:
- '4563-4599:4563-4599'
- '8055:8080'
environment:
- SERVICES=s3
- DEBUG=1
- DATA_DIR=/tmp/localstack/data
volumes:
- './.localstack:/var/lib/localstack'
- '/var/run/docker.sock:/var/run/docker.sock'

View File

@ -1,15 +0,0 @@
services:
my_app:
image: web-app:latest
container_name: web-app
ports:
- "8080:8080"
volumes:
- first-volume-data:/container-path-1
- second-volume-data:/container-path-2:ro
volumes:
first-volume-data:
driver: local
second-volume-data:
driver: local

View File

@ -1,51 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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>
<artifactId>docker-compose</artifactId>
<description>Demo project for Spring Boot and Docker</description>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-boot-3</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../parent-boot-3</relativePath>
</parent>
<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>
<configuration>
<mainClass>com.baeldung.docker.app.DockAppApplication</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,8 +0,0 @@
version: "3.9"
services:
ubuntu:
image: "ubuntu:latest"
tty: true
alpine:
image: "alpine:latest"
tty: true

View File

@ -1,10 +0,0 @@
version: "3.9"
services:
ubuntu:
image: "ubuntu:latest"
tty: true
depends_on:
- "alpine"
alpine:
image: "alpine:latest"
tty: true

View File

@ -1,13 +0,0 @@
package com.baeldung.docker.app;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DockAppApplication {
public static void main(String[] args) {
SpringApplication.run(DockAppApplication.class, args);
}
}

View File

@ -1,13 +0,0 @@
package com.baeldung.docker.app.endpoint;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class MyController {
@GetMapping
public String version() {
return "1.7";
}
}

View File

@ -1,13 +0,0 @@
package com.baeldung.docker.app;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class DockAppApplicationUnitTest {
@Test
void contextLoads() {
}
}

View File

@ -1,13 +0,0 @@
services:
my_app:
image: web-app:latest
container_name: web-app
ports:
- "8080:8080"
networks:
- my-app
networks:
my-app:
name: redis_network
external: true

View File

@ -1,13 +0,0 @@
services:
redis:
image: redis:latest
container_name: redis
ports:
- '6379:6379'
networks:
- network
networks:
network:
driver: bridge
name: redis_network

View File

@ -1,12 +0,0 @@
services:
my_app:
image: web-app:latest
container_name: web-app
ports:
- "8080:8080"
networks:
- network-example
networks:
network-example:
external: true

View File

@ -1,12 +0,0 @@
services:
redis:
image: redis:latest
container_name: redis
ports:
- '6379:6379'
networks:
- network-example
networks:
network-example:
external: true

View File

@ -1,10 +0,0 @@
FROM alpine:latest
ARG name
ENV env_name $name
COPY greetings.sh .
RUN chmod +x /greetings.sh
CMD ["/greetings.sh"]

View File

@ -1,3 +0,0 @@
## Relevant Articles:
- [How to Pass Environment Variable Value into Dockerfile](https://www.baeldung.com/ops/dockerfile-env-variable)

View File

@ -1,3 +0,0 @@
#!/bin/sh
echo Hello $env_name

View File

@ -1,33 +0,0 @@
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/

View File

@ -1,7 +0,0 @@
### Relevant Articles:
- [Pushing a Docker Image to a Private Repository](https://www.baeldung.com/ops/docker-push-image-to-private-repository)
- [How to Include Files Outside of Dockers Build Context](https://www.baeldung.com/ops/docker-include-files-outside-build-context)
- [Adding a Comment in a Dockerfile](https://www.baeldung.com/ops/docker-dockerfile-comments)
- [Updating PATH Environment Variable in Dockerfile](https://www.baeldung.com/ops/dockerfile-path-environment-variable)
- [Keep Subdirectory Structure in Dockerfile Copy](https://www.baeldung.com/ops/dockerfile-copy-same-subdirectory-structure)

View File

@ -1,2 +0,0 @@
FROM ubuntu:latest # Declare parent image
RUN echo 'This is a Baeldung tutorial'

View File

@ -1,2 +0,0 @@
FROM ubuntu:latest
RUN echo 'This is a Baeldung tutorial' # Print sentence

View File

@ -1,2 +0,0 @@
FROM ubuntu:latest
RUN echo 'This is a Baeldung tutorial'

View File

@ -1,4 +0,0 @@
# This file is a demonstration
# For a Baeldung article
FROM ubuntu:latest
RUN echo 'This is a Baeldung tutorial'

View File

@ -1,4 +0,0 @@
# escape=`
FROM ubuntu:latest
RUN echo 'This is a Baeldung tutorial&' `
&& echo 'Print more stuff'

View File

@ -1,4 +0,0 @@
# Declare parent image
FROM ubuntu:latest
# Print sentence
RUN echo 'This is a Baeldung tutorial'

View File

@ -1,2 +0,0 @@
FROM nginx:latest
COPY nginx.conf /etc/nginx/nginx.conf

View File

@ -1,8 +0,0 @@
events {}
http {
server {
listen 80;
index index.html;
}
}

View File

@ -1,3 +0,0 @@
FROM nginx:latest
COPY sample-site/html/* /etc/nginx/html/
COPY config/nginx.conf /etc/nginx/nginx.conf

View File

@ -1,2 +0,0 @@
FROM sample-site-base:latest
COPY html/* /etc/nginx/html/

View File

@ -1,3 +0,0 @@
FROM nginx:latest
COPY html/* /etc/nginx/html/
COPY config/nginx.conf /etc/nginx/nginx.conf

View File

@ -1,6 +0,0 @@
mkdir tmp-context
cp -R ../html tmp-context/
cp -R ../../config tmp-context/
cp Dockerfile-script tmp-context/Dockerfile
docker build -t sample-site:latest tmp-context
rm -rf tmp-context

View File

@ -1,10 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Sample Site</title>
</head>
<body>
<h2>Welcome to the first page of the site</h2>
</body>
</html>

View File

@ -1,3 +0,0 @@
FROM ubuntu:latest
COPY folder1/ folder2/ /workdir/
RUN ls --recursive /workdir/

View File

@ -1,3 +0,0 @@
FROM ubuntu:latest
COPY folder1/ /workdir/
RUN ls --recursive /workdir/

View File

@ -1,5 +0,0 @@
FROM ubuntu:latest
COPY folder1/ /workdir/
RUN ls --recursive /workdir/
COPY folder2/ /workdir/
RUN ls --recursive /workdir/

View File

@ -1,41 +0,0 @@
<?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>
<artifactId>docker-images</artifactId>
<description>Example application to showcase Docker images features</description>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-boot-2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../parent-boot-2</relativePath>
</parent>
<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>

View File

@ -1,4 +0,0 @@
FROM openjdk:11
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-jar","/app.jar"]

View File

@ -1,13 +0,0 @@
package com.baeldung.docker;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MainApplication {
public static void main(String[] args) {
SpringApplication.run(MainApplication .class, args);
}
}

View File

@ -1,12 +0,0 @@
package com.baeldung.docker.controllers;
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!";
}
}

View File

@ -1,5 +0,0 @@
FROM ubuntu:latest
RUN echo $PATH
RUN echo "export PATH=$PATH:/etc/profile" >> ~/.bashrc
RUN cat ~/.bashrc
RUN echo $PATH

View File

@ -1,4 +0,0 @@
FROM ubuntu:latest
RUN echo $PATH
ENV PATH="$PATH:/etc/profile"
RUN echo $PATH

View File

@ -1,4 +0,0 @@
FROM ubuntu:latest
RUN echo $PATH
RUN export PATH="$PATH:/etc/profile"; echo $PATH
RUN echo $PATH

View File

@ -1,4 +0,0 @@
[submodule "project"]
path = project
url = https://github.com/eugenp/tutorials.git
branch = master

View File

@ -1,13 +0,0 @@
ADD git-strategies /project/
ADD /build/ /project/
ADD /output/project.jar /project/
ADD ssh-private-key /root/.ssh/id_rsa
RUN git clone git@github.com:eugenp/tutorials.git
ARG username=$GIT_USERNAME
ARG password=$GIT_PASSWORD
RUN git clone https://username:password@github.com:eugenp/tutorials.git
VOLUME /build/ /project/

View File

@ -1,3 +0,0 @@
## Relevant Articles:
- [Dockerfile Strategies for Git](https://www.baeldung.com/ops/dockerfile-git-strategies)

View File

@ -1,3 +0,0 @@
### Relevant Articles:
- [An Introduction to Kaniko](https://www.baeldung.com/ops/kaniko)

View File

@ -1,2 +0,0 @@
FROM ubuntu
ENTRYPOINT ["/bin/bash", "-c", "echo hello"]

View File

@ -1,19 +0,0 @@
apiVersion: v1
kind: Pod
metadata:
name: kaniko
spec:
containers:
- name: kaniko
image: gcr.io/kaniko-project/executor:latest
args: ["--dockerfile=/workspace/dockerfile",
"--context=dir://workspace",
"--no-push"]
volumeMounts:
- name: dockerfile-storage
mountPath: /workspace
restartPolicy: Never
volumes:
- name: dockerfile-storage
persistentVolumeClaim:
claimName: dockerfile-claim

View File

@ -1,11 +0,0 @@
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: dockerfile-claim
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 8Gi
storageClassName: local-storage

View File

@ -1,14 +0,0 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: dockerfile
labels:
type: local
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
storageClassName: local-storage
hostPath:
path: /home/docker/kaniko # Path to the local mount directory that was setup

View File

@ -14,16 +14,11 @@
</parent>
<modules>
<module>docker-caching</module>
<module>docker-compose</module>
<module>docker-compose-2</module>
<module>docker-containers</module>
<module>docker-images</module>
<module>docker-spring-boot</module>
<module>docker-spring-boot-postgres</module>
<module>docker-java-jar</module>
<module>jib</module>
<!-- <module>kaniko</module> --> <!-- Not a maven project -->
</modules>
</project>