genuinetools / img

Standalone, daemon-less, unprivileged Dockerfile and OCI compatible container image builder.
https://blog.jessfraz.com/post/building-container-images-securely-on-kubernetes/
MIT License
3.89k stars 231 forks source link

Support multiple tags being passed with img build #181

Closed westonsteimel closed 5 years ago

westonsteimel commented 5 years ago

Support multi-tagging with img build per #150

westonsteimel commented 5 years ago

Sample of passing multiple tags to img build:

$ $GOPATH/bin/img build -t tag-test1 -t tag-test2:v1 -t tag-test-3 .
Building docker.io/library/tag-test1:latest
Setting up the rootfs... this may take a bit.
[+] Building 0.1s (3/3) FINISHED                                                                                                                              
 => [internal] load .dockerignore                                                                                                                        0.0s
 => => transferring context: 2B                                                                                                                          0.0s
 => [internal] load build definition from Dockerfile                                                                                                     0.0s
 => => transferring dockerfile: 31B                                                                                                                      0.0s
 => exporting to image                                                                                                                                   0.0s
 => => exporting layers                                                                                                                                  0.0s
 => => exporting manifest sha256:a4041598cb334293bc21d9c8fd43154ad63e8326260012356b10b6920804f703                                                        0.0s
 => => exporting config sha256:2012639ed7fac4c4052fd1e8d934521418f0f31b7a4f931910678e6c0a3a354d                                                          0.0s
 => => naming to docker.io/library/tag-test1:latest                                                                                                      0.0s
 => => naming to docker.io/library/tag-test2:v1                                                                                                          0.0s
 => => naming to docker.io/library/tag-test-3:latest                                                                                                     0.0s
Successfully built docker.io/library/tag-test1:latest

$ img ls
NAME                    SIZE    CREATED AT  UPDATED AT  DIGEST
docker.io/library/tag-test-3:latest 677B    10 minutes ago  10 minutes ago  sha256:a4041598cb334293bc21d9c8fd43154ad63e8326260012356b10b6920804f703
docker.io/library/tag-test1:latest  677B    10 minutes ago  10 minutes ago  sha256:a4041598cb334293bc21d9c8fd43154ad63e8326260012356b10b6920804f703
docker.io/library/tag-test2:v1      677B    10 minutes ago  10 minutes ago  sha256:a4041598cb334293bc21d9c8fd43154ad63e8326260012356b10b6920804f703
westonsteimel commented 5 years ago

I just left the two printf statements showing the first tag from the list, but can change it to be whatever you think is best. Buildkit already has a line for each tag in the output though.

codecov[bot] commented 5 years ago

Codecov Report

Merging #181 into master will not change coverage. The diff coverage is 0%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #181   +/-   ##
=====================================
  Coverage       0%     0%           
=====================================
  Files          13     13           
  Lines         735    737    +2     
=====================================
- Misses        735    737    +2
Impacted Files Coverage Δ
build.go 0% <0%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 535ef54...322515d. Read the comment docs.

jessfraz commented 5 years ago

oh this is awesome thanks!