Skip to content

Commit

Permalink
allow use of host:port in a FROM instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
petitlapin committed Jan 15, 2022
1 parent 57c2db8 commit f5e79e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Language/Docker/Parser/From.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ import Language.Docker.Syntax

parseRegistry :: (?esc :: Char) => Parser Registry
parseRegistry = do
domain <- someUnless "a domain name" (== '.')
void $ char '.'
tld <- someUnless "a TLD" (== '/')
registry <- someUnless "a registry" (== '/')
void $ char '/'
return $ Registry (domain <> "." <> tld)
return $ Registry (registry)

parsePlatform :: (?esc :: Char) => Parser Platform
parsePlatform = do
Expand Down
4 changes: 4 additions & 0 deletions test/Language/Docker/ParserSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ spec = do
assertAst
"FROM myregistry.com:5000/imagename:5.12-dev"
[From (taggedImage (Image (Just "myregistry.com:5000") "imagename") "5.12-dev")]
it "parse without '.*' on registry and port and tag" $
assertAst
"FROM myregistry:5000/imagename:5.12-dev"
[From (taggedImage (Image (Just "myregistry.com:5000") "imagename") "5.12-dev")]
it "Not a registry if no TLD" $
assertAst
"FROM myfolder/imagename:5.12-dev"
Expand Down

0 comments on commit f5e79e0

Please sign in to comment.