Skip to content

Instantly share code, notes, and snippets.

@usrbinkat
Last active October 14, 2022 00:43
Show Gist options
  • Save usrbinkat/761d8f2f4da018d861451aff45b2cde7 to your computer and use it in GitHub Desktop.
Save usrbinkat/761d8f2f4da018d861451aff45b2cde7 to your computer and use it in GitHub Desktop.
Chainguard Wolfi go-containerregistry

Hacking on UOR Framework based ai-model-registry

Build Container

cat <<EOF > Dockerfile && docker build -t registry .
FROM --platform=x86_64 cgr.dev/chainguard/go:latest-glibc as build
RUN CGO_ENABLED=0 GOBIN=/home/nonroot go install github.com/google/go-containerregistry/cmd/registry@latest

FROM --platform=x86_64 cgr.dev/chainguard/static:latest
COPY --from=build /home/nonroot/registry /registry

ENTRYPOINT ["/registry", "-port", "5000"]
EXPOSE 5000
EOF

Image size

usrbinkat@wasmx:~$ docker images registry
REPOSITORY   TAG       IMAGE ID       CREATED         SIZE
registry     latest    df4c8a6ad85b   6 minutes ago   8.44MB

Run Container

docker run -d -p 5000:5000 --name registry registry
[
{
"Id": "sha256:df4c8a6ad85b3ae6e2993c54271c05cba5f5c5c7adbc8d7ac57a507a508bfa25",
"RepoTags": [
"registry:latest",
"ghcr.io/uor-community/registry:latest"
],
"RepoDigests": [
"ghcr.io/uor-community/registry@sha256:6597ad6167364075945eb1c61740083315ef02c0f516ad98c924f4b9045d71a3"
],
"Parent": "sha256:04419b58e082e91ba302778559c1e51914c189b9e7eac65392f31385d2e5ce92",
"Comment": "",
"Created": "2022-10-13T19:33:43.182967804Z",
"Container": "125cdfe63accf0b508b95279519f98d936f68754e53413504cc199e86bb56c16",
"ContainerConfig": {
"Hostname": "125cdfe63acc",
"Domainname": "",
"User": "65532",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"5000/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt"
],
"Cmd": [
"/bin/sh",
"-c",
"#(nop) ",
"EXPOSE 5000"
],
"Image": "sha256:04419b58e082e91ba302778559c1e51914c189b9e7eac65392f31385d2e5ce92",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": [
"/registry",
"-port",
"5000"
],
"OnBuild": null,
"Labels": {}
},
"DockerVersion": "20.10.12",
"Author": "",
"Config": {
"Hostname": "",
"Domainname": "",
"User": "65532",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"5000/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt"
],
"Cmd": null,
"Image": "sha256:04419b58e082e91ba302778559c1e51914c189b9e7eac65392f31385d2e5ce92",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": [
"/registry",
"-port",
"5000"
],
"OnBuild": null,
"Labels": null
},
"Architecture": "amd64",
"Os": "linux",
"Size": 8438868,
"VirtualSize": 8438868,
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/d3967e1bc25c1d421bf75b620854a2d6b289b49ca26cb8a51961313d827a5f9c/diff",
"MergedDir": "/var/lib/docker/overlay2/74298887ebc21e2f1e6c5802ea2db1b372b2c5817191f0b8562cbc183555baaf/merged",
"UpperDir": "/var/lib/docker/overlay2/74298887ebc21e2f1e6c5802ea2db1b372b2c5817191f0b8562cbc183555baaf/diff",
"WorkDir": "/var/lib/docker/overlay2/74298887ebc21e2f1e6c5802ea2db1b372b2c5817191f0b8562cbc183555baaf/work"
},
"Name": "overlay2"
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:9c759b327f46e9cfb985d4cd6efa1a63cfc7ae958a6f4dc80a4c5698d38438ec",
"sha256:5c5fa749243217ec3cfd39a46bf7949fcf2641446b63aff3fa472d24c7cafad4"
]
},
"Metadata": {
"LastTagTime": "2022-10-13T19:38:02.701100673Z"
}
}
]
@pdxjohnny
Copy link

🎉🥳

LICENSE?

@usrbinkat
Copy link
Author

@pdxjohnny can you clarify?

@pdxjohnny
Copy link

If this is standalone is there a license others may reuse it under? Or do you see this getting upstreamed into the docs of the AI Model Registry project?

@usrbinkat
Copy link
Author

@pdxjohnny the git repository is the only thing I'm worried about a license on. The gist is not important.

@pdxjohnny
Copy link

https://github.com/uor-community/ai-model-registry

Ah i see you’ve already upstreamed it! My mistake, awesome work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment