Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

SPRING BOOT DANS UN CONTAINER OUTILS ET PRATIQUES

156 vues

Publié le

Pivotal Paris: SPRING BOOT DANS UN CONTAINER OUTILS ET PRATIQUES

Publié dans : Logiciels
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • Soyez le premier à aimer ceci

SPRING BOOT DANS UN CONTAINER OUTILS ET PRATIQUES

  1. 1. SPRING BOOT DANS UNSPRING BOOT DANS UN CONTAINERCONTAINER OUTILS ET PRATIQUESOUTILS ET PRATIQUES PIVOTAL PARISPIVOTAL PARIS 04 / 07 / 201904 / 07 / 2019
  2. 2. DANIEL GARNIER-MOIROUXDANIEL GARNIER-MOIROUX So ware Engineer @ Pivotal Labs @Kehrlann github.com/kehrlann/spring-boot-in-a-container
  3. 3. QUI UTILISE DES CONTAINERS EN PRODUCTIONQUI UTILISE DES CONTAINERS EN PRODUCTION AUJOURD'HUI ?AUJOURD'HUI ?
  4. 4. CHOIX DE L'IMAGE DE BASECHOIX DE L'IMAGE DE BASE
  5. 5. DOCKERFILE, V1.0DOCKERFILE, V1.0 FROM ubuntu:latest RUN apt update && apt install openjdk-8-jre -y COPY spring-petclinic/target/spring-petclinic-2.1.0.BUILD-SNAPSHOT.jar /app.jar ENTRYPOINT ["java","-jar","/app.jar"]
  6. 6. UN PEU MIEUX...UN PEU MIEUX... FROM openjdk:8-jre COPY spring-petclinic/target/spring-petclinic-2.1.0.BUILD-SNAPSHOT.jar /app.jar ENTRYPOINT ["java","-jar","/app.jar"]
  7. 7. PLUS LÉGER !PLUS LÉGER ! FROM openjdk:8-jre-alpine COPY spring-petclinic/target/spring-petclinic-2.1.0.BUILD-SNAPSHOT.jar /app.jar ENTRYPOINT ["java","-jar","/app.jar"]
  8. 8. ENCORE MOINS DE SURFACEENCORE MOINS DE SURFACE (... mais un peu plus gros en taille) FROM gcr.io/distroless/java COPY spring-petclinic/target/spring-petclinic-2.1.0.BUILD-SNAPSHOT.jar /app.jar CMD ["/app.jar"]
  9. 9. IMAGE DE BASE - TAKE-AWAYSIMAGE DE BASE - TAKE-AWAYS Container != VM Utiliser une image spécialisée Penser à la taille (ex: alpine) Penser à la sécurité (ex: distroless)
  10. 10. INTERLUDEINTERLUDE
  11. 11. VIRTUALISATIONVIRTUALISATION
  12. 12. CONTAINERSCONTAINERS
  13. 13. LES LAYERS: COMMENT ÇA MARCHELES LAYERS: COMMENT ÇA MARCHE
  14. 14. LES LAYERSLES LAYERS FROM réutilise toutes les layers de l'image de base. Les layers sont créées par : RUN COPY ADD
  15. 15. LES LAYERS: RÉUTILISATIONLES LAYERS: RÉUTILISATION
  16. 16. REVENONS À NOS MOUTONS ...REVENONS À NOS MOUTONS ... FROM gcr.io/distroless/java COPY spring-petclinic/target/spring-petclinic-2.1.0.BUILD-SNAPSHOT.jar /app.jar CMD ["/app.jar"]
  17. 17. LAYERING: EXTRACTION DES DÉPENDANCESLAYERING: EXTRACTION DES DÉPENDANCES DEPS_FOLDER=$PWD/spring-petclinic/target/dependency mkdir -p "$DEPS_FOLDER" cd "$DEPS_FOLDER" jar -xf ../*.jar
  18. 18. LAYERING: CRÉATION DE L'IMAGELAYERING: CRÉATION DE L'IMAGE FROM gcr.io/distroless/java ARG DEPENDENCY=spring-petclinic/target/dependency COPY ${DEPENDENCY}/BOOT-INF/lib /app/lib COPY ${DEPENDENCY}/META-INF /app/META-INF COPY ${DEPENDENCY}/BOOT-INF/classes /app ENTRYPOINT [ "java", "-cp", "app:app/lib/*", "org.springframework.samples.petclinic.PetClinicApplication" ]
  19. 19. CONSTRUIRE SES IMAGES - TAKE-AWAYSCONSTRUIRE SES IMAGES - TAKE-AWAYS Choisir son image de base (taille, sécurité, ...) Séparer dépendances & code dans des layers séparées
  20. 20. BUILD PROCESSBUILD PROCESS
  21. 21. MULTI-STAGE BUILDSMULTI-STAGE BUILDS # BUILD SOURCE FROM openjdk:8-jdk-alpine as build WORKDIR /workspace/spring-petclinic/ COPY spring-petclinic/mvnw . COPY spring-petclinic/.mvn .mvn COPY spring-petclinic/pom.xml . COPY spring-petclinic/src src RUN ./mvnw package -DskipTests RUN mkdir -p target/dependency && (cd target/dependency; jar -xf ../*.jar) # BUILD IMAGE FROM gcr.io/distroless/java ARG DEPENDENCY=/workspace/spring-petclinic/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", "-cp", "app:app/lib/*", "org.springframework.samples.petclinic.PetClinicApplication" ]
  22. 22. MULTI-STAGE BUILDS, WITH CACHINGMULTI-STAGE BUILDS, WITH CACHING # BUILD SOURCE FROM openjdk:8-jdk-alpine as build WORKDIR /workspace/spring-petclinic/ COPY spring-petclinic/mvnw . COPY spring-petclinic/.mvn .mvn COPY spring-petclinic/pom.xml . COPY spring-petclinic/src src RUN --mount=type=cache,target=/root/.m2 ./mvnw clean package -DskipTests RUN mkdir -p target/dependency && (cd target/dependency; jar -xf ../*.jar) # BUILD IMAGE FROM gcr.io/distroless/java ARG DEPENDENCY=/workspace/spring-petclinic/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", "-cp", "app:app/lib/*", "org.springframework.samples.petclinic.PetClinicApplication" ]
  23. 23. REALLY ?REALLY ?
  24. 24. GOOGLE JIBGOOGLE JIB Dans votre pom.xml, il suffit d'ajouter: Puis, run: Voire: <build> [...] <plugins> <plugin> <groupId>com.google.cloud.tools</groupId> <artifactId>jib-maven-plugin</artifactId> <version>1.3.0</version> <configuration> <to> <image>kehrlann/pet-clinic:jib</image> </to> </configuration> </plugin> </plugins> </build> $ mvn compile jib:dockerBuild $ mvn compile jib:build
  25. 25. ALSO, CLOUD-NATIVE BUILDPACKSALSO, CLOUD-NATIVE BUILDPACKS Build from source ! $ pack build kehrlann/pet-clinic:pack-cf-cn-buildpack --builder=cloudfoundry/cnb
  26. 26. BUILD PROCESS - TAKE-AWAYSBUILD PROCESS - TAKE-AWAYS Le process de build, c'est important Mais si on peut éviter d'y penser, c'est mieux Standardiser la création d'images, c'est top
  27. 27. A VOTRE TOUR !A VOTRE TOUR ! Faites moi signe: @Kehrlann https://spring.io/guides/topicals/spring-boot-docker/ https://github.com/Kehrlann/spring-boot-in-a-container/

×