Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PORT=8080
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
FROM adoptopenjdk/openjdk11:alpine-slim as build
WORKDIR /workspace/app

ARG PORT
ENV PORT ${PORT}

COPY mvnw .
COPY .mvn .mvn
COPY pom.xml .
Expand All @@ -15,4 +18,4 @@ ARG DEPENDENCY=/workspace/app/target/dependency
COPY --from=build ${DEPENDENCY}/BOOT-INF/lib /app/lib
COPY --from=build ${DEPENDENCY}/META-INF /app/META-INF
COPY --from=build ${DEPENDENCY}/BOOT-INF/classes /app
ENTRYPOINT ["java","-Dserver.port=${PORT}","-cp","app:app/lib/*","com.example.demo.DemoApplication"]
ENTRYPOINT ["java","-cp","app:app/lib/*","com.example.demo.DemoApplication"]
44 changes: 0 additions & 44 deletions Jenkinsfile

This file was deleted.

16 changes: 16 additions & 0 deletions Jenkinsfile-1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
pipeline {
agent { label 'macos' }
options {
buildDiscarder(logRotator(numToKeepStr: '5'))
}
stages {
stage('Tooling versions') {
steps {
sh '''
docker --version
docker compose version
'''
}
}
}
}
45 changes: 45 additions & 0 deletions Jenkinsfile-2
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
pipeline {
agent { label 'macos' }
options {
buildDiscarder(logRotator(numToKeepStr: '5'))
}
environment {
DOCKER_HUB_CREDS = credentials('darinpope-docker-hub')
AWS_CREDS = credentials('darinpope-aws-creds')
KEYCHAIN_PASSWORD = credentials('darinpope-keychain')
}
stages {
stage('Tooling versions') {
steps {
sh '''
docker --version
docker compose version
'''
}
}
stage('Unlock keychain') {
steps {
sh 'security -v unlock-keychain -p $KEYCHAIN_PASSWORD ~/Library/Keychains/login.keychain-db'
}
}
stage('Build') {
steps {
sh 'docker context use default'
sh 'docker compose build'
sh 'docker compose push'
}
}
stage('Deploy') {
steps {
sh 'docker context use myecscontext'
sh 'docker compose up'
sh 'docker compose ps --format json'
}
}
}
post {
always {
sh 'security -v lock-keychain ~/Library/Keychains/login.keychain-db'
}
}
}
8 changes: 8 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
x-aws-vpc: "vpc-0dece3d7dce2d0578"
services:
web:
image: darinpope/java-web-app:latest
build:
context: .
ports:
- "8080:8080"
8 changes: 4 additions & 4 deletions src/main/java/com/example/demo/DemoApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
@RestController
public class DemoApplication {

public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}

@RequestMapping("/")
public String home() {
return "Hello Docker World!";
return "Hello World!";
}
}
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@

server.port=8080