Coder Social home page Coder Social logo

snyk-boot-web's Introduction

Snyk Boot Web Demo - Pas DOTC Events

alt tag

Steps to create the container image

  • Ensure you have JDK 11 installed as follows
$ java -version
java version "11.0.13" 2021-10-19 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.13+10-LTS-370)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.13+10-LTS-370, mixed mode)
  • Build the artifact image as follows
$ mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< com.example:snyk-boot-web >----------------------
[INFO] Building snyk-boot-web 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
....

[INFO]
[INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) @ snyk-boot-web ---
[INFO] Building jar: /Users/pasapicella/snyk/demos/languages-code-demos/java/snyk-boot-web/target/snyk-boot-web-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:2.3.10.RELEASE:repackage (repackage) @ snyk-boot-web ---
[INFO] Replacing main artifact with repackaged archive
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.595 s
[INFO] Finished at: 2024-02-14T11:03:49+11:00
[INFO] ------------------------------------------------------------------------
  • Make sure Springboot JAR file was created at "target/snyk-boot-web-0.0.1-SNAPSHOT.jar"

  • Create a container image as follows here I am using Dockerhub and you would need Docker desktop running to perform these steps

$ docker build --tag=snyk-boot-web:latest .
$ docker tag snyk-boot-web:latest {userID}/snyk-boot-web:latest
$ docker push {USERID}/snyk-boot-web:latest

Run on Kubernetes

  • The following Kubernetes config file exists in the ./kubernetes folder you can use that as a starting guide.

Note: No service is exposed so you can't access the application without a Service or using port forward to allow access. The Kubernetes integration does not need the application exposed

apiVersion: apps/v1
kind: Deployment
metadata:
  name: snyk-boot-web
  namespace: apples
spec:
  selector:
    matchLabels:
      app: snyk-boot-web
  replicas: 1
  template:
    metadata:
      labels:
        app: snyk-boot-web
    spec:
      containers:
        - name: snyk-boot-web
          image: pasapples/snyk-boot-web:v1
          imagePullPolicy: Always
          ports:
            - containerPort: 5000

Pas Apicella [pas at snyk.io] is a Principal Solution Engineer at Snyk APJ

snyk-boot-web's People

Contributors

papicella avatar deepsourcebot avatar snyk-bot avatar thaithanh0703 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.