Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow use of host:port in a FROM instruction #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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