-
-
Save efekarakus/038e3e576cd66e159e83088fe68055d0 to your computer and use it in GitHub Desktop.
Prototyping dependency removal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// parse parses the contents of a Dockerfile into a Dockerfile struct. | |
func parse(content string) (*Dockerfile, error) { | |
var df Dockerfile | |
//df.ExposedPorts = []portConfig{} | |
// | |
//ast, err := parser.Parse(strings.NewReader(content)) | |
//if err != nil { | |
// return nil, fmt.Errorf("parse reader: %w", err) | |
//} | |
// | |
//for _, child := range ast.AST.Children { | |
// // ParseInstruction converts an AST to a typed instruction. | |
// // Does prevalidation checks before parsing | |
// // Example of an instruction is HEALTHCHECK CMD curl -f http://localhost/ || exit 1. | |
// instruction, err := instructions.ParseInstruction(child) | |
// if err != nil { | |
// return nil, fmt.Errorf("parse instructions: %w", err) | |
// } | |
// inst := fmt.Sprint(instruction) | |
// | |
// // Getting the value at a children will return the Dockerfile directive | |
// switch d := child.Value; d { | |
// case "expose": | |
// currentPorts := parseExpose(inst) | |
// df.ExposedPorts = append(df.ExposedPorts, currentPorts...) | |
// case "healthcheck": | |
// healthcheckOptions, err := parseHealthCheck(inst) | |
// if err != nil { | |
// return nil, err | |
// } | |
// df.HealthCheck = healthcheckOptions | |
// } | |
//} | |
return &df, nil | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- github.com/moby/buildkit v0.8.3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment