Bọn mình sau khi thắc mắc có thể đẩy 1 file bất kỳ lên Docker registry không thì bạn Minh đã tìm ra 1 tool để làm việc này.
info của bạn: https://github.com/HaPhanBaoMinh
ORAS (OCI Registry As Storage) is an open-source tool that makes it easy to upload any file—not just container images—to OCI-compliant registries like Docker Hub, GitHub Container Registry, and Azure Container Registry. It’s cross-platform and lightweight, and using it to push files to a Docker registry takes just a few CLI commands. Here’s how you can guide your WordPress audience to get started:
Docker and Helm chỉ tập trung vào containers and charts.
Để lưu trữ các tạo tác mục đích chung như:
.ziparchives.pdfdocuments.jsonconfigs.wasmmodules- …
Chúng ta cần một công cụ hỗ trợ nội dung tùy ý và các loại phương tiện tùy chỉnh. Đó là những gì ORAS làm.
1. Cài đặt ORAS
Trên macOS:
brew install oras
trên windows:
winget install oras
Install on Linux:
VERSION="1.5.2"
curl -LO "https://github.com/oras-project/oras/releases/download/v${VERSION}/oras_${VERSION}_linux_amd64.tar.gz"
mkdir -p oras-install/
tar -zxf oras_${VERSION}_*.tar.gz -C oras-install/
sudo mv oras-install/oras /usr/local/bin/
rm -rf oras_${VERSION}_*.tar.gz oras-install/
2) ORAS login
oras login localhost:8080 -u robot\$user1 -p YAFxcZKPPARqhAa8GZylsDOIOkMZCJN3 WARNING! Using --password via the CLI is insecure. Use --password-stdin. Login Succeeded
Explanation:
robot\$user1:Tạo tên tài khoản robot trong phiên HarborYAFxcZKPPARqhAa8GZylsDOIOkMZCJN3:Mật khẩu tài khoản robot
3) ORAS push artifact
oras push localhost:8080/2_6_0_pri/template:2_6_0 \ --username "robot\$user1" \ --password "YAFxcZKPPARqhAa8GZylsDOIOkMZCJN3" \ 2_6_0.zip:application/zip OUTPUT: WARNING! Using --password via the CLI is insecure. Use --password-stdin. ✓ Exists 2_6_0.zip 34.9/34.9 kB 100.00% 0s └─ sha256:19e3e48a49d32c68f1d66c623fd1f8911c525557baff18d4605bbd338d3121bd ✓ Exists application/vnd.oci.empty.v1+json 2/2 B 100.00% 0s └─ sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a ✓ Uploaded application/vnd.oci.image.manifest.v1+json 568/568 B 100.00% 52ms └─ sha256:831c695ee1830bb650de60df25be5c17d543b8a39f016d176835ffc69d1d6db8 Pushed [registry] localhost:8080/2_6_0_pri/template:2_6_0 ArtifactType: application/vnd.unknown.artifact.v1 Digest: sha256:831c695ee1830bb650de60df25be5c17d543b8a39f016d176835ffc69d1d6db8
Explanation:
localhost:8080: URL của kho chứa Harbor2_6_0_pri/template:2_6_0: project/repo:tag2_6_0.zip:application/zip: file path and media type- Robot account phải có
pushpermission trên kho lưu trữ đó.
Common File Types and Media Types for ORAS:
| File type | Media type | Description |
|---|---|---|
.zip | application/zip | Standard compressed bundle |
.json | application/json | Configuration, structured data |
.pdf | application/pdf | Documents, specs |
| custom files | application/vnd.<yourorg>.<type>.v1+<format> | Custom typed artifact (e.g., Helm, AI) |
Bây giờ bạn có thể thấy chúng ta có cái Artifacts mới trong 2_6_0_pri/template
4) ORAS pull artifact
oras pull localhost:8080/2_6_0_pri/template:2_6_0 \ --username "robot\$user1" \ --password "YAFxcZKPPARqhAa8GZylsDOIOkMZCJN3" OUTPUT: WARNING! Using --password via the CLI is insecure. Use --password-stdin. ✓ Pulled 2_6_0.zip 34.9/34.9 kB 100.00% 5ms └─ sha256:19e3e48a49d32c68f1d66c623fd1f8911c525557baff18d4605bbd338d3121bd ✓ Pulled application/vnd.oci.image.manifest.v1+json 568/568 B 100.00% 0s └─ sha256:831c695ee1830bb650de60df25be5c17d543b8a39f016d176835ffc69d1d6db8 Pulled [registry] localhost:8080/2_6_0_pri/template:2_6_0 Digest: sha256:831c695ee1830bb650de60df25be5c17d543b8a39f016d176835ffc69d1d6db8
ls
OUTPUT:
2_6_0.zip
Explanation:
localhost:8080: Harbor registry URL2_6_0_pri/template:2_6_0: project/repo:tag- Robot account phải có
pullpermission trên repo repo.