To tag and push an OCI image to Artifactory with buildctl:
Run the following command:
buildctl build \ --frontend=dockerfile.v0 \ --local context=. \ --local dockerfile=. \ --output type=image,name=[JFrogPlatformURL]/<REPO_NAME>/<IMAGE>:<TAG>,push=true \ --export-cache type=registry,ref=[JFrogPlatformURL]/<REPO_NAME>/<IMAGE>:<TAG>,mode=max,push=true \ --import-cache type=registry,ref=[JFrogPlatformURL]/<REPO_NAME>/<IMAGE>:<TAG>
Where:
[JFrogPlatformURL]: The URL of your JPD, without the protocol schema<REPO_NAME>: The name of the target repository<IMAGE>: The image name<TAG>: The tags you want to apply to the image
For example:
buildctl build \ --frontend=dockerfile.v0 \ --local context=. \ --local dockerfile=. \ --output type=image,name=company.jfrog.io/oci-local/froggy-app:v1.0.0,push=true \ --export-cache type=registry,ref=company.jfrog.io/oci-local/froggy-app:v1.0.0,mode=max,push=true \ --import-cache type=registry,ref=company.jfrog.io/oci-local/froggy-app:v1.0.0
Note
You can also use JFrog Set me up to copy the snippet populated with your token and environment. For more information, see Use Artifactory Set Me Up for Configuring Package Manager Clients.