Skip to content

Java, Spring boot, Github Action and Docker integration

Notifications You must be signed in to change notification settings

rohitpshelar/ghAction-Docker

Repository files navigation

ghAction-Docker

Java, Spring boot, Github Action and Docker integration

    - uses: mr-smithers-excellent/docker-build-push@v6
      name: Build & push Docker image
      with:
        image: rohitpshelar/ghaction-docker
        tags: v1, latest
        registry: docker.io
        dockerfile: Dockerfile.ci
        username: ${{ secrets.DOCKER_USERNAME }}
        password: ${{ secrets.DOCKER_PASSWORD }}
  • Add DOCKER_USERNAME in GitHub > Settings > Actions secrets and variables > Repository secrets > New

  • Create new file as Dockerfile.ci ref - Dockerfile.ci

  • Add below code to this file

    From openjdk:21
    EXPOSE 8080
    RUN mkdir /app
    COPY build/libs/*.jar /app/ghAction-Docker.jar
    ENTRYPOINT ["java","-jar","/app/ghAction-Docker.jar"]
tasks.bootJar {
	archiveFileName.set("ghAction-Docker.jar")
}
  • Once you commit above changes, GitHub will run the workflow and image will be sent to docker.
  • This image can be pulled into local DockerDesktop with below command
docker pull rohitpshelar/ghaction-docker
docker images
docker run -p 8080:8080 rohitpshelar/ghaction-docker

About

Java, Spring boot, Github Action and Docker integration

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages