Skip to content

Commit 7b63198

Browse files
committed
example Docker image requiring a database connection
1 parent 45c947d commit 7b63198

16 files changed

Lines changed: 447 additions & 0 deletions

File tree

aws/aws-rds-hello-world/.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
HELP.md
2+
.gradle
3+
build/
4+
!gradle/wrapper/gradle-wrapper.jar
5+
!**/src/main/**
6+
!**/src/test/**
7+
8+
### STS ###
9+
.apt_generated
10+
.classpath
11+
.factorypath
12+
.project
13+
.settings
14+
.springBeans
15+
.sts4-cache
16+
17+
### IntelliJ IDEA ###
18+
.idea
19+
*.iws
20+
*.iml
21+
*.ipr
22+
out/
23+
24+
### NetBeans ###
25+
/nbproject/private/
26+
/nbbuild/
27+
/dist/
28+
/nbdist/
29+
/.nb-gradle/
30+
31+
### VS Code ###
32+
.vscode/

aws/aws-rds-hello-world/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM openjdk:8-jdk-alpine
2+
ARG JAR_FILE=build/libs/*.jar
3+
COPY ${JAR_FILE} app.jar
4+
ENTRYPOINT ["java","-jar","/app.jar"]
5+
EXPOSE 8080

aws/aws-rds-hello-world/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# RDS Hello World
2+
3+
This is a simple Spring Boot application which requires access to a PostgreSQL database.
4+
5+
The application has a single endpoint `/hello` which prints out if the database connection was successful.
6+
7+
Get it in a Docker image via `docker pull reflectoring/aws-rds-hello-world`.
8+
9+
Use the image instead of your real application to test AWS CloudFormation stacks which need access to a database.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
plugins {
2+
id 'org.springframework.boot' version '2.2.4.RELEASE'
3+
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
4+
id 'java'
5+
}
6+
7+
group = 'io.reflectoring'
8+
version = '0.0.1-SNAPSHOT'
9+
sourceCompatibility = '1.8'
10+
11+
repositories {
12+
mavenCentral()
13+
}
14+
15+
dependencies {
16+
implementation 'org.springframework.boot:spring-boot-starter-web'
17+
18+
// database
19+
implementation 'org.flywaydb:flyway-core'
20+
implementation 'org.springframework.boot:spring-boot-starter-data-jdbc'
21+
runtimeOnly 'org.postgresql:postgresql'
22+
testRuntimeOnly 'org.postgresql:postgresql'
23+
24+
testImplementation('org.springframework.boot:spring-boot-starter-test') {
25+
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
26+
}
27+
}
28+
29+
test {
30+
useJUnitPlatform()
31+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: '3.7'
2+
3+
services:
4+
5+
postgres:
6+
container_name: "rds-hello-world"
7+
image: postgres
8+
volumes:
9+
- rds-hello-world:/var/lib/postgresql/data
10+
ports:
11+
- 5432:5432
12+
environment:
13+
- POSTGRES_USER=hello
14+
- POSTGRES_PASSWORD=hello
15+
16+
volumes:
17+
rds-hello-world:
18+
driver: local
54.9 KB
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

aws/aws-rds-hello-world/gradlew

Lines changed: 172 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aws/aws-rds-hello-world/gradlew.bat

Lines changed: 84 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = 'aws-rds-hello-world'

0 commit comments

Comments
 (0)