We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3fc6b81 commit e1e16b0Copy full SHA for e1e16b0
1 file changed
.github/actions/prepare-build/action.yml
@@ -57,10 +57,15 @@ runs:
57
# Extract the last FROM image using Python
58
upstream=$(python3 - << 'EOF'
59
from dockerfile_parse import DockerfileParser
60
+ from dockerfile_parse.parser import image_from
61
with open("${{ inputs.containerfile }}", "r") as f:
62
dfp = DockerfileParser(fileobj=f)
- froms = [s['value'].split()[0] for s in dfp.structure if s['instruction'] == 'FROM']
63
- print(froms[-1])
+ froms = [image_from(s['value']) for s in dfp.structure if s['instruction'] == 'FROM']
64
+ upstream = froms[-1][0]
65
+ for image, name in reversed(froms):
66
+ if name == upstream:
67
+ upstream = image
68
+ print(upstream)
69
EOF
70
)
71
echo "upstream-image=$upstream" >> $GITHUB_OUTPUT
0 commit comments