File: parse-docker-tag.awk

package info (click to toggle)
proot 5.4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,012 kB
  • sloc: ansic: 18,627; sh: 1,662; python: 108; asm: 41; makefile: 16; awk: 6
file content (10 lines) | stat: -rwxr-xr-x 314 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
#!/usr/bin/awk -f
# Convert Dockerfile path to image tag
# input: ./docker/alpine/x86_64/gcc/Dockerfile
# output: alpine-x86_64-gcc
{
  gsub(/\//,"-"); # replace / with -
  split($0,a,"docker-"); # remove leading directories
  split(a[2],b,"-Docker"); # remove trailing Dockerfile
  print b[1] # print final tag
}