SlideShare a Scribd company logo
Effective Java
Docker Pipeline
Effective build for lean and secure Java Docker images
About me…
•Chief of Research @codefresh.io
•github.com/alexei-led/pumba
•#docker, #golang, #aws
•medium.com/@alexeiled
•@alexeiled
The “Naive” Approach
Follow familiar VM build and install flow
# start from ubuntu
FROM ubuntu:14.04
# add required packages and java repository
RUN apt-get update && apt-get install -y python-software-properties software-properties-
common
RUN add-apt-repository ppa:webupd8team/java
# install Oracle JDK 8 with auto-accept license agreement
RUN echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 boolean true" |
debconf-set-selections
RUN apt-get update && apt-get install -y oracle-java8-installer maven
# add ALL project files
ADD . /usr/local/app
# build Java application with Maven (fetch packages, compile, test and deploy)
RUN cd /usr/local/app && mvn install
# define default command to run the application
CMD ["/usr/bin/java", "-jar", "-Dspring.profiles.active=test", "/usr/local/app/target/
spring-boot-rest-example-0.3.0.war"]
Docker Image Size = 1.3 GB
Docker Built Time = 27 min
“Standard” Approach
FROM java:8
# Install maven
RUN apt-get update
RUN apt-get install -y maven
WORKDIR /code
# Prepare by downloading dependencies
ADD pom.xml /code/pom.xml
RUN ["mvn", "dependency:resolve"]
RUN ["mvn", "verify"]
# Adding source, compile and package into a fat jar
ADD src /code/src
RUN ["mvn", "package"]
EXPOSE 4567
CMD ["/usr/bin/java", "-jar", "-Dspring.profiles.active=test", "target/spring-boot-rest-
example-0.3.0.war"]
Docker Image Size = 1.2 GB
Docker Built Time = 15 min
Take Library OpenJDK image, add pom.xml first…
Stay away from these abstractions
Containers are not VM
and
they are not like “lightweight” VM
–Joe Fernandes, senior director, OpenShift Product Management, Red Hat
“A Linux container is nothing more than a
process that runs on Linux. It shares a host
kernel with other containerized processes.”
What is the bare minimum
required to run Java App?
1. Base Image with C Runtime and Posix shell (Alpine)
2. Java Runtime Environment (OpenJDK JRE)
3. Application byte-code and resources (app.jar)
4. 3rd Party Libraries (lib/*.jar)
5. Optionally HTTP server (Tomcat/Jetty/Netty/…)
Docker Image Size
• time to build
• network latency
• storage
• service availability and elasticity
• security
• development agility
Docker Builder Pattern
• 2 Dockerfiles
• 1st for build tools
• 2nd for runtime
Java Docker Builder
1. Base Image with C Runtime and Posix shell (Alpine)
2. Java Development Kit (OpenJDK)
3. Javac or other JVM compiler (Scala, Kotlin, …)
4. Build Management Tool (Maven, SBT, Gradle, …)
5. Linters, code scanners, test frameworks, test tools, …
Maven Builder Dockerfile
FROM openjdk:8-jdk-alpine
RUN apk add --no-cache curl tar bash
ARG MAVEN_VERSION=3.3.9
ARG USER_HOME_DIR="/root"
RUN mkdir -p /usr/share/maven && 
curl -fsSL http://apache.osuosl.org/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-
$MAVEN_VERSION-bin.tar.gz | tar -xzC /usr/share/maven --strip-components=1 && 
ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
ENV MAVEN_HOME /usr/share/maven
ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"
# speed up Maven JVM a bit
ENV MAVEN_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
ENTRYPOINT ["/usr/bin/mvn"]
# make source folder
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# install maven dependency packages (keep in image)
COPY pom.xml /usr/src/app
RUN mvn -T 1C install && rm -rf target
# copy other source files (keep in image)
COPY src /usr/src/app/src
Java App Dockerfile
FROM openjdk:8-jre-alpine
COPY spring-boot-*.war /app.war
CMD ["/usr/bin/java", "-jar", "-Dspring.profiles.active=test", "/app.war"]
263 MB 143 MB
Build Pipeline Orchestration
GNU make
Docker multi-stage build
Next Container101 Webinar
Makefile
…
builder:
    docker build -t $(NS)/builder:mvn -f Dockerfile.build .
mvn-package: builder
    docker run -it --rm -v $(shell pwd)/target:/usr/src/app/target $(NS)/builder:mvn
package -T 1C -o -Dmaven.test.skip=true
mvn-test: builder
    docker run -it --rm -v $(shell pwd)/target:/usr/src/app/target $(NS)/builder:mvn
-T 1C -o test
docker:
    docker build -t $(NS)/$(REPO):$(VERSION) target
build: builder
    make docker
push:
    docker push $(NS)/$(REPO):$(VERSION)
release: build
    make push -e VERSION=$(VERSION)
…
default: build
version: '1.0'
steps:
mvn_builder:
type: build
description: create Maven builder
dockerfile: Dockerfile.build
image_name: alexeiled/mvn-builder
mvn_test:
description: run unit tests
image: ${{mvn_builder}}
commands:
- mvn -T 1C -o test
mvn_package:
description: package application WAR
image: ${{mvn_builder}}
commands:
- mvn package -T 1C -o -Dmaven.test.skip=true
build_image:
type: build
description: create Docker image with application WAR
dockerfile: Dockerfile
working_directory: ${{main_clone}}/target
image_name: alexei-led/sbdemo
image_push:
type: push
description: push to DockerHub
candidate: '${{build_image}}'
tag: ‘${{CF_BRANCH}}'
Codefresh YAML
https://codefresh.io/blog/java_docker_pipeline/
Next Steps
• Try Codefresh free- www.codefresh.io
• Additional info on Docker - www.codefresh.io/blog
• Meetups & Webinars - www.codefresh.io/meetups
• Twitter - @codefresh

More Related Content

What's hot (20)

PDF
Azure Meetup Stuttgart - Multi-arch Docker images
Stefan Scherer
 
PDF
Dockerfile
Jeffrey Ellin
 
PPTX
Developer South Coast 2018: Docker on Windows - The Beginner's Guide
Elton Stoneman
 
PDF
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
Eric Smalling
 
PPTX
CloudExpo 2018: Docker - Power Your Move to the Cloud
Elton Stoneman
 
PDF
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
Docker, Inc.
 
PPTX
Docker for .NET Developers
Taswar Bhatti
 
PDF
Continuous Integration with Docker on AWS
Andrew Heifetz
 
PDF
Lessons Learned: Using Concourse In Production
Shingo Omura
 
PDF
Deployment Automation with Docker
Egor Pushkin
 
PPTX
Hooking Docker With Selenium
Sujith Vakathanam
 
KEY
How To Make A Framework Plugin That Does Not Suck
Max Andersen
 
PPTX
Continuous Delivery With Selenium Grid And Docker
Barbara Gonzalez
 
PDF
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)
Nils De Moor
 
PDF
Virtual Meetup Docker + Arm: Building Multi-arch Apps with Buildx
Docker, Inc.
 
PDF
Introducción a contenedores Docker
Software Guru
 
PPTX
Containers #101 : Docker ONBUILD triggers and Introduction to Docker Compose
Raziel Tabib (Join our team)
 
PPTX
Introduction to dockerfile, SF Peninsula Software Development Meetup @Guidewire
dotCloud
 
PDF
Docker Tooling for Eclipse
Max Andersen
 
PDF
Stop Being Lazy and Test Your Software
Laura Frank Tacho
 
Azure Meetup Stuttgart - Multi-arch Docker images
Stefan Scherer
 
Dockerfile
Jeffrey Ellin
 
Developer South Coast 2018: Docker on Windows - The Beginner's Guide
Elton Stoneman
 
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
Eric Smalling
 
CloudExpo 2018: Docker - Power Your Move to the Cloud
Elton Stoneman
 
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
Docker, Inc.
 
Docker for .NET Developers
Taswar Bhatti
 
Continuous Integration with Docker on AWS
Andrew Heifetz
 
Lessons Learned: Using Concourse In Production
Shingo Omura
 
Deployment Automation with Docker
Egor Pushkin
 
Hooking Docker With Selenium
Sujith Vakathanam
 
How To Make A Framework Plugin That Does Not Suck
Max Andersen
 
Continuous Delivery With Selenium Grid And Docker
Barbara Gonzalez
 
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)
Nils De Moor
 
Virtual Meetup Docker + Arm: Building Multi-arch Apps with Buildx
Docker, Inc.
 
Introducción a contenedores Docker
Software Guru
 
Containers #101 : Docker ONBUILD triggers and Introduction to Docker Compose
Raziel Tabib (Join our team)
 
Introduction to dockerfile, SF Peninsula Software Development Meetup @Guidewire
dotCloud
 
Docker Tooling for Eclipse
Max Andersen
 
Stop Being Lazy and Test Your Software
Laura Frank Tacho
 

Similar to Webinar: Creating an Effective Docker Build Pipeline for Java Apps (20)

PDF
Java in a world of containers
Docker, Inc.
 
PDF
Java in a World of Containers - DockerCon 2018
Arun Gupta
 
PPTX
Introduction to JIB and Google Cloud Run
Saiyam Pathak
 
PDF
DCSF 19 Building Your Development Pipeline
Docker, Inc.
 
PDF
Extending Build to the Client: A Maven User's Guide to Grunt.js
Petr Jiricka
 
PDF
What is this "docker"
Jean-Marc Meessen
 
PDF
Vagrant or docker for java dev environment
Orest Ivasiv
 
PDF
Omaha (Google Update) server
Dmitry Lyfar
 
PDF
Docker module 1
Liang Bo
 
PDF
Scala, docker and testing, oh my! mario camou
J On The Beach
 
PDF
[Szjug] Docker. Does it matter for java developer?
Izzet Mustafaiev
 
ODP
Aug penguin16
alhino
 
PPT
Docker, a new LINUX container technology based light weight virtualization
Suresh Balla
 
PPTX
Docker - Demo on PHP Application deployment
Arun prasath
 
PDF
Docker研習營
Philip Zheng
 
PDF
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Erica Windisch
 
PPTX
Detailed Introduction To Docker
nklmish
 
PDF
PDXPortland - Dockerize Django
Hannes Hapke
 
PDF
OpenSCAP Overview(security scanning for docker image and container)
Jooho Lee
 
PPTX
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
Patrick Chanezon
 
Java in a world of containers
Docker, Inc.
 
Java in a World of Containers - DockerCon 2018
Arun Gupta
 
Introduction to JIB and Google Cloud Run
Saiyam Pathak
 
DCSF 19 Building Your Development Pipeline
Docker, Inc.
 
Extending Build to the Client: A Maven User's Guide to Grunt.js
Petr Jiricka
 
What is this "docker"
Jean-Marc Meessen
 
Vagrant or docker for java dev environment
Orest Ivasiv
 
Omaha (Google Update) server
Dmitry Lyfar
 
Docker module 1
Liang Bo
 
Scala, docker and testing, oh my! mario camou
J On The Beach
 
[Szjug] Docker. Does it matter for java developer?
Izzet Mustafaiev
 
Aug penguin16
alhino
 
Docker, a new LINUX container technology based light weight virtualization
Suresh Balla
 
Docker - Demo on PHP Application deployment
Arun prasath
 
Docker研習營
Philip Zheng
 
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Erica Windisch
 
Detailed Introduction To Docker
nklmish
 
PDXPortland - Dockerize Django
Hannes Hapke
 
OpenSCAP Overview(security scanning for docker image and container)
Jooho Lee
 
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
Patrick Chanezon
 
Ad

More from Codefresh (20)

PDF
Detect, debug, deploy with Codefresh and Lightstep
Codefresh
 
PDF
CICD Pipelines for Microservices: Lessons from the Trenches
Codefresh
 
PDF
Simplify Your Code with Helmfile
Codefresh
 
PDF
Making the Most of Helm 3 with Codefresh
Codefresh
 
PDF
5 Simple Tips for Troubleshooting Your Kubernetes Pods
Codefresh
 
PDF
Best Practices for Microservice CI/CD: Lessons from Expedia and Codefresh
Codefresh
 
PDF
Hybrid CI/CD with Kubernetes & Codefresh
Codefresh
 
PDF
VM vs Docker-Based Pipelines
Codefresh
 
PDF
Why You Should be Using Multi-stage Docker Builds in 2019
Codefresh
 
PPTX
Deploy Secure Cloud-Native Apps Fast
Codefresh
 
PDF
CICD Pipelines for Microservices Best Practices
Codefresh
 
PDF
Codefresh CICD New Features Launch! May 2019
Codefresh
 
PDF
Terraform GitOps on Codefresh
Codefresh
 
PDF
Adding Container Image Scanning to Your Codefresh Pipelines with Anchore
Codefresh
 
PDF
Image scanning using Clair
Codefresh
 
PDF
Updating Kubernetes With Helm Charts: Build, Test, Deploy with Codefresh and...
Codefresh
 
PDF
Docker based-Pipelines with Codefresh
Codefresh
 
PDF
Automated Serverless Pipelines with #GitOps on Codefresh
Codefresh
 
PDF
Discovering and Fixing Dependency Vulnerabilities for Kubernetes apps with Sn...
Codefresh
 
PDF
Net Pipeline on Windows Kubernetes
Codefresh
 
Detect, debug, deploy with Codefresh and Lightstep
Codefresh
 
CICD Pipelines for Microservices: Lessons from the Trenches
Codefresh
 
Simplify Your Code with Helmfile
Codefresh
 
Making the Most of Helm 3 with Codefresh
Codefresh
 
5 Simple Tips for Troubleshooting Your Kubernetes Pods
Codefresh
 
Best Practices for Microservice CI/CD: Lessons from Expedia and Codefresh
Codefresh
 
Hybrid CI/CD with Kubernetes & Codefresh
Codefresh
 
VM vs Docker-Based Pipelines
Codefresh
 
Why You Should be Using Multi-stage Docker Builds in 2019
Codefresh
 
Deploy Secure Cloud-Native Apps Fast
Codefresh
 
CICD Pipelines for Microservices Best Practices
Codefresh
 
Codefresh CICD New Features Launch! May 2019
Codefresh
 
Terraform GitOps on Codefresh
Codefresh
 
Adding Container Image Scanning to Your Codefresh Pipelines with Anchore
Codefresh
 
Image scanning using Clair
Codefresh
 
Updating Kubernetes With Helm Charts: Build, Test, Deploy with Codefresh and...
Codefresh
 
Docker based-Pipelines with Codefresh
Codefresh
 
Automated Serverless Pipelines with #GitOps on Codefresh
Codefresh
 
Discovering and Fixing Dependency Vulnerabilities for Kubernetes apps with Sn...
Codefresh
 
Net Pipeline on Windows Kubernetes
Codefresh
 
Ad

Recently uploaded (20)

PPTX
Networking_Essentials_version_3.0_-_Module_5.pptx
ryan622010
 
PDF
BRKACI-1003 ACI Brownfield Migration - Real World Experiences and Best Practi...
fcesargonca
 
PDF
The Internet - By the numbers, presented at npNOG 11
APNIC
 
PPTX
PHIPA-Compliant Web Hosting in Toronto: What Healthcare Providers Must Know
steve198109
 
PPTX
Softuni - Psychology of entrepreneurship
Kalin Karakehayov
 
PDF
Top 10 Testing Procedures to Ensure Your Magento to Shopify Migration Success...
CartCoders
 
PDF
BRKAPP-1102 - Proactive Network and Application Monitoring.pdf
fcesargonca
 
PPTX
西班牙巴利阿里群岛大学电子版毕业证{UIBLetterUIB文凭证书}文凭复刻
Taqyea
 
PDF
BRKACI-1001 - Your First 7 Days of ACI.pdf
fcesargonca
 
PDF
Digital burnout toolkit for youth workers and teachers
asociatiastart123
 
PPTX
Metaphysics_Presentation_With_Visuals.pptx
erikjohnsales1
 
PDF
Boardroom AI: The Next 10 Moves | Cerebraix Talent Tech
ssuser73bdb11
 
PPTX
Orchestrating things in Angular application
Peter Abraham
 
DOCX
Custom vs. Off-the-Shelf Banking Software
KristenCarter35
 
PPTX
Lec15_Mutability Immutability-converted.pptx
khanjahanzaib1
 
PPTX
法国巴黎第二大学本科毕业证{Paris 2学费发票Paris 2成绩单}办理方法
Taqyea
 
PDF
Enhancing Parental Roles in Protecting Children from Online Sexual Exploitati...
ICT Frame Magazine Pvt. Ltd.
 
PDF
BRKSP-2551 - Introduction to Segment Routing.pdf
fcesargonca
 
PPTX
Presentation3gsgsgsgsdfgadgsfgfgsfgagsfgsfgzfdgsdgs.pptx
SUB03
 
PPTX
L1A Season 1 ENGLISH made by A hegy fixed
toszolder91
 
Networking_Essentials_version_3.0_-_Module_5.pptx
ryan622010
 
BRKACI-1003 ACI Brownfield Migration - Real World Experiences and Best Practi...
fcesargonca
 
The Internet - By the numbers, presented at npNOG 11
APNIC
 
PHIPA-Compliant Web Hosting in Toronto: What Healthcare Providers Must Know
steve198109
 
Softuni - Psychology of entrepreneurship
Kalin Karakehayov
 
Top 10 Testing Procedures to Ensure Your Magento to Shopify Migration Success...
CartCoders
 
BRKAPP-1102 - Proactive Network and Application Monitoring.pdf
fcesargonca
 
西班牙巴利阿里群岛大学电子版毕业证{UIBLetterUIB文凭证书}文凭复刻
Taqyea
 
BRKACI-1001 - Your First 7 Days of ACI.pdf
fcesargonca
 
Digital burnout toolkit for youth workers and teachers
asociatiastart123
 
Metaphysics_Presentation_With_Visuals.pptx
erikjohnsales1
 
Boardroom AI: The Next 10 Moves | Cerebraix Talent Tech
ssuser73bdb11
 
Orchestrating things in Angular application
Peter Abraham
 
Custom vs. Off-the-Shelf Banking Software
KristenCarter35
 
Lec15_Mutability Immutability-converted.pptx
khanjahanzaib1
 
法国巴黎第二大学本科毕业证{Paris 2学费发票Paris 2成绩单}办理方法
Taqyea
 
Enhancing Parental Roles in Protecting Children from Online Sexual Exploitati...
ICT Frame Magazine Pvt. Ltd.
 
BRKSP-2551 - Introduction to Segment Routing.pdf
fcesargonca
 
Presentation3gsgsgsgsdfgadgsfgfgsfgagsfgsfgzfdgsdgs.pptx
SUB03
 
L1A Season 1 ENGLISH made by A hegy fixed
toszolder91
 

Webinar: Creating an Effective Docker Build Pipeline for Java Apps

  • 1. Effective Java Docker Pipeline Effective build for lean and secure Java Docker images
  • 2. About me… •Chief of Research @codefresh.io •github.com/alexei-led/pumba •#docker, #golang, #aws •medium.com/@alexeiled •@alexeiled
  • 3. The “Naive” Approach Follow familiar VM build and install flow # start from ubuntu FROM ubuntu:14.04 # add required packages and java repository RUN apt-get update && apt-get install -y python-software-properties software-properties- common RUN add-apt-repository ppa:webupd8team/java # install Oracle JDK 8 with auto-accept license agreement RUN echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 boolean true" | debconf-set-selections RUN apt-get update && apt-get install -y oracle-java8-installer maven # add ALL project files ADD . /usr/local/app # build Java application with Maven (fetch packages, compile, test and deploy) RUN cd /usr/local/app && mvn install # define default command to run the application CMD ["/usr/bin/java", "-jar", "-Dspring.profiles.active=test", "/usr/local/app/target/ spring-boot-rest-example-0.3.0.war"] Docker Image Size = 1.3 GB Docker Built Time = 27 min
  • 4. “Standard” Approach FROM java:8 # Install maven RUN apt-get update RUN apt-get install -y maven WORKDIR /code # Prepare by downloading dependencies ADD pom.xml /code/pom.xml RUN ["mvn", "dependency:resolve"] RUN ["mvn", "verify"] # Adding source, compile and package into a fat jar ADD src /code/src RUN ["mvn", "package"] EXPOSE 4567 CMD ["/usr/bin/java", "-jar", "-Dspring.profiles.active=test", "target/spring-boot-rest- example-0.3.0.war"] Docker Image Size = 1.2 GB Docker Built Time = 15 min Take Library OpenJDK image, add pom.xml first…
  • 5. Stay away from these abstractions Containers are not VM and they are not like “lightweight” VM
  • 6. –Joe Fernandes, senior director, OpenShift Product Management, Red Hat “A Linux container is nothing more than a process that runs on Linux. It shares a host kernel with other containerized processes.”
  • 7. What is the bare minimum required to run Java App? 1. Base Image with C Runtime and Posix shell (Alpine) 2. Java Runtime Environment (OpenJDK JRE) 3. Application byte-code and resources (app.jar) 4. 3rd Party Libraries (lib/*.jar) 5. Optionally HTTP server (Tomcat/Jetty/Netty/…)
  • 8. Docker Image Size • time to build • network latency • storage • service availability and elasticity • security • development agility
  • 9. Docker Builder Pattern • 2 Dockerfiles • 1st for build tools • 2nd for runtime
  • 10. Java Docker Builder 1. Base Image with C Runtime and Posix shell (Alpine) 2. Java Development Kit (OpenJDK) 3. Javac or other JVM compiler (Scala, Kotlin, …) 4. Build Management Tool (Maven, SBT, Gradle, …) 5. Linters, code scanners, test frameworks, test tools, …
  • 11. Maven Builder Dockerfile FROM openjdk:8-jdk-alpine RUN apk add --no-cache curl tar bash ARG MAVEN_VERSION=3.3.9 ARG USER_HOME_DIR="/root" RUN mkdir -p /usr/share/maven && curl -fsSL http://apache.osuosl.org/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven- $MAVEN_VERSION-bin.tar.gz | tar -xzC /usr/share/maven --strip-components=1 && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn ENV MAVEN_HOME /usr/share/maven ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2" # speed up Maven JVM a bit ENV MAVEN_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1" ENTRYPOINT ["/usr/bin/mvn"] # make source folder RUN mkdir -p /usr/src/app WORKDIR /usr/src/app # install maven dependency packages (keep in image) COPY pom.xml /usr/src/app RUN mvn -T 1C install && rm -rf target # copy other source files (keep in image) COPY src /usr/src/app/src
  • 12. Java App Dockerfile FROM openjdk:8-jre-alpine COPY spring-boot-*.war /app.war CMD ["/usr/bin/java", "-jar", "-Dspring.profiles.active=test", "/app.war"]
  • 14. Build Pipeline Orchestration GNU make Docker multi-stage build Next Container101 Webinar
  • 15. Makefile … builder:     docker build -t $(NS)/builder:mvn -f Dockerfile.build . mvn-package: builder     docker run -it --rm -v $(shell pwd)/target:/usr/src/app/target $(NS)/builder:mvn package -T 1C -o -Dmaven.test.skip=true mvn-test: builder     docker run -it --rm -v $(shell pwd)/target:/usr/src/app/target $(NS)/builder:mvn -T 1C -o test docker:     docker build -t $(NS)/$(REPO):$(VERSION) target build: builder     make docker push:     docker push $(NS)/$(REPO):$(VERSION) release: build     make push -e VERSION=$(VERSION) … default: build
  • 16. version: '1.0' steps: mvn_builder: type: build description: create Maven builder dockerfile: Dockerfile.build image_name: alexeiled/mvn-builder mvn_test: description: run unit tests image: ${{mvn_builder}} commands: - mvn -T 1C -o test mvn_package: description: package application WAR image: ${{mvn_builder}} commands: - mvn package -T 1C -o -Dmaven.test.skip=true build_image: type: build description: create Docker image with application WAR dockerfile: Dockerfile working_directory: ${{main_clone}}/target image_name: alexei-led/sbdemo image_push: type: push description: push to DockerHub candidate: '${{build_image}}' tag: ‘${{CF_BRANCH}}' Codefresh YAML
  • 18. Next Steps • Try Codefresh free- www.codefresh.io • Additional info on Docker - www.codefresh.io/blog • Meetups & Webinars - www.codefresh.io/meetups • Twitter - @codefresh