[JAVA] Publish Docker Image on GitHub Package Registry

Create a Docker image in the GitHub Package Registry. This time, the goal is to create an image of a Java application with Jib and push it.

Official Publish JAR to GitHub Package Registry with Gradle

Gradle settings

build.gradle


plugins {
    id 'com.google.cloud.tools.jib' version '1.5.1'
}

jib {
    to {
        image = "docker.pkg.github.com/minebreaker/abukuma/abukuma-example:0.0.0.2-EXPLORING_GITHUB_REGISTRY"
        auth {
            username = project.hasProperty("GITHUB_USER") ? GITHUB_USER : ''
            password = project.hasProperty("GITHUB_TOKEN") ? GITHUB_TOKEN : ''
        }
    }
}

It should be noted that even if the user name or repository is in uppercase, it must be converted to lowercase.

Build & publish with jib task immediately.

* What went wrong:
Execution failed for task ':abukuma-example:jib'.
> com.google.cloud.tools.jib.plugins.common.BuildStepsExecutionException: Tried to check BLOB exists for docker.pkg.github.com/minebreaker/abukuma/abukuma-example with digest sha256:e8d8785a314f385d3675a017f4e2df1707c528c06e7a7989663fdab4900bd8ff but failed because: Did not receive Content-Length header | If this is a bug, please file an issue at https://github.com/GoogleContainerTools/jib/issues/new

This is suspicious. .. .. If you can't see the Content-Length, it's likely that you're not responding to your request.

Build

There is no help for it, so just create an image with jibDockerBuild.

Built image to Docker daemon as docker.pkg.github.com/minebreaker/abukuma/abukuma-example:0.0.0.2-EXPLORING_GITHUB_REGISTRY
Executing tasks:
[==============================] 100.0% complete

> Task :abukuma-example:jibDockerBuild

BUILD SUCCESSFUL in 10s

According to the documentation, I was able to push without problems.

docker login docker.pkg.github.com -u minebreaker -p [[TOKEN]]
docker push docker.pkg.github.com/minebreaker/abukuma/abukuma-example:0.0.0.2-EXPLORING_GITHUB_REGISTRY

pull.

docker pull docker.pkg.github.com/minebreaker/abukuma/abukuma-example:0.0.0.2-exploring_github_registry

Summary

I want to complete it with Jib ...

Recommended Posts

Publish Docker Image on GitHub Package Registry
Publish JAR on Gradle on GitHub Package Registry
Steps to push Docker image to GitHub Container Registry (ghcr.io)
[Docker] Build a site on Hugo and publish it on GitHub
Install openjdk8 on Docker image (Debian)
Deploy Flask's Docker image on Heroku
2. Create Docker image and register Registry
Minimal Workflow to push Docker image to Github Container Registry with Github Actions
Docker push to GitHub Container Registry (ghcr.io)
Customize OpenFOAM v8 Docker Image on Mac
Set up Docker Registry locally on CentOS 7
Liberty on Docker
Test, build, and push your Docker image to GitHub Container Registry using GitHub Actions
Update container image with KUSANAGI Runs on Docker
Redmine on Docker
GitHub Actions/Cache: Cache bundle installed gems on Docker container
Push Docker images from GitHub Actions to GitHub Container Registry
Docker installation on CentOS 6
The story of pushing a Docker container to GitHub Package Registry and Docker Hub with GitHub Actions
python notes on docker
Install Docker on Manjaro
Delete unused docker image
Try actions on GitHub [actions]
M.S. docker on Windows
Docker installation on WSL2
Run phpunit on Docker
Until you run Quarkus and run docker image on Amazon ECS
[Personal notes] How to push a Docker image to GitHub Packages
Getting Started with GitHub Container Registry instead of Docker Hub