GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: parse healthcheck in dockerfile by seongm-1 · Pull Request #971 · aws/copilot-cli

This repository was archived by the owner on Jun 22, 2026. It is now read-only.

Conversation

@seongm-1

@seongm-1 seongm-1 commented May 27, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

The ability to parse Healthcheck options from a user's dockerfile.

Also added, some of Moby buildkit packages for ease of parsing dockerfile.

https://godoc.org/github.com/moby/buildkit/frontend/dockerfile/parser
https://godoc.org/github.com/moby/buildkit/frontend/dockerfile/instructions

Addresses #938

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Binary Size (added Mobykit parsers)
Before: 44.2 MB
After: 44.4 MB

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@seongm-1
seongm-1 requested a review from a team as a code owner May 27, 2020 15:43
@seongm-1
seongm-1 requested a review from kohidave May 27, 2020 15:43
@kohidave
kohidave requested review from efekarakus and iamhopaul123 May 27, 2020 17:46
iamhopaul123
iamhopaul123 reviewed May 27, 2020
View reviewed changes
Comment thread internal/pkg/docker/dockerfile/dockerfile.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread internal/pkg/docker/dockerfile/dockerfile.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread internal/pkg/docker/dockerfile/dockerfile.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread internal/pkg/docker/dockerfile/dockerfile.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread internal/pkg/docker/dockerfile/dockerfile.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread internal/pkg/docker/dockerfile/dockerfile.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread internal/pkg/docker/dockerfile/dockerfile.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread internal/pkg/docker/dockerfile/dockerfile.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread internal/pkg/docker/dockerfile/dockerfile.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread internal/pkg/docker/dockerfile/dockerfile.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

@kohidave kohidave mentioned this pull request May 27, 2020
Use 'docker inspect' to populate some settings #470
Closed
@seongm-1
seongm-1 requested a review from iamhopaul123 June 1, 2020 21:46
iamhopaul123
iamhopaul123 reviewed Jun 1, 2020
View reviewed changes
Comment thread internal/pkg/docker/dockerfile/dockerfile.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

iamhopaul123
iamhopaul123 reviewed Jun 1, 2020
View reviewed changes
Comment thread internal/pkg/docker/dockerfile/dockerfile.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

iamhopaul123
iamhopaul123 reviewed Jun 1, 2020
View reviewed changes
Comment thread internal/pkg/docker/dockerfile/dockerfile_test.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread internal/pkg/docker/dockerfile/dockerfile.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

efekarakus
efekarakus reviewed Jun 1, 2020
View reviewed changes

@efekarakus efekarakus left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff! mostly some Go best-practices.

Do we need a GetHealthcheck() (*HealthCheck, error) method? I think this PR parses the content but doesn't provide a way for clients to access the HealthCheck.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread internal/pkg/docker/dockerfile/dockerfile.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread internal/pkg/docker/dockerfile/dockerfile.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread internal/pkg/docker/dockerfile/dockerfile.go Outdated
}

// parse takes a Dockerfile and fills in struct members based on methods like parseExpose and (TODO) parseHealthcheck
// parse takes a Dockerfile and fills in struct members based on methods like parseExpose and parseHealthcheck

@efekarakus efekarakus Jun 1, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/golang/go/wiki/CodeReviewComments#comment-sentences

Comments should begin with the name of the thing being described and end in a period

This wiki page is pretty neat and contains all sorts of best-practices, if you'd like to take a look when you've time :)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

seongm-1 reacted with thumbs up emoji seongm-1 reacted with eyes emoji
All reactions
  • 👍 1 reaction
  • 👀 1 reaction
Comment thread internal/pkg/docker/dockerfile/dockerfile.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread internal/pkg/docker/dockerfile/dockerfile.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread internal/pkg/docker/dockerfile/dockerfile.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread internal/pkg/docker/dockerfile/dockerfile.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread internal/pkg/docker/dockerfile/dockerfile.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread internal/pkg/docker/dockerfile/dockerfile.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread internal/pkg/docker/dockerfile/dockerfile_test.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

@seongm-1
seongm-1 requested review from efekarakus and iamhopaul123 June 2, 2020 22:08
efekarakus
efekarakus approved these changes Jun 3, 2020
View reviewed changes

@efekarakus efekarakus left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great 🚀 tiny nits! once addressed feel free to remove the "do-not-merge" label and mergify can auto-merge after 2 approvals 😁.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread internal/pkg/docker/dockerfile/dockerfile.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread internal/pkg/docker/dockerfile/dockerfile.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread internal/pkg/docker/dockerfile/dockerfile_test.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

@efekarakus efekarakus added the do-not-merge Pull requests that mergify shouldn't merge until the requester allows it. label Jun 3, 2020
efekarakus
efekarakus reviewed Jun 3, 2020
View reviewed changes
Comment thread internal/pkg/docker/dockerfile/dockerfile.go
inst := fmt.Sprint(instruction)

// Getting the value at a children will return the Dockerfile directive
switch d := child.Value; d {

@efekarakus efekarakus Jun 3, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like what you did with ParseInstruction! I just realized that the instruction itself is already parsed into a moby type and we don't need to parse it again :D

Can try something like this:

var hc *HealthCheck
switch t := instruction.(type); t {
case *instructions.ExposeCommand:
// Read fields from t.
case *instructions.HealthCheckCommand:
    hc = &HealthCheck{
         interval: uint16(t.Health.Interval.Seconds()),
         // ... same for other fields
    }
}

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@seongm-1 seongm-1 Jun 3, 2020

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talked about it offline and it provided a compiler error. Might have to tackle this later on.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@efekarakus efekarakus Jun 3, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good but I think it's worthwhile addressing it because it will significantly remove code from us and will keep it in sync with how Docker parses the file.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
seongm-1 added 6 commits June 3, 2020 12:57
@seongm-1
feat: parse healthcheck in dockerfile (#971)
7c23d0d
@seongm-1
Added constants for flag and more tests
9d57ce4
@seongm-1
Changed ioutil to afero for readfile
79b9099
@seongm-1
changes for better golan gpractices
f9e543c
@seongm-1
pr comments
6a0fc1e
@seongm-1
go.sum file changes
8e702a6
iamhopaul123
iamhopaul123 approved these changes Jun 3, 2020
View reviewed changes

@iamhopaul123 iamhopaul123 left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@seongm-1 seongm-1 removed the do-not-merge Pull requests that mergify shouldn't merge until the requester allows it. label Jun 3, 2020
@mergify
mergify Bot merged commit 5b87893 into aws:master Jun 3, 2020
@seongm-1 seongm-1 mentioned this pull request Jun 5, 2020
Inserting Healthcheck from Dockerfile to Manifest Design #996
Closed
@bvtujo bvtujo mentioned this pull request Jun 8, 2020
Add Dockerfile parser to app init workflow #718
Closed
@efekarakus efekarakus mentioned this pull request Jun 29, 2020
Parse Healthcheck from Dockerfile Design #938
Closed
@seongm-1 seongm-1 mentioned this pull request Jul 10, 2020
E2E tests for Parsing Healthcheck to Backend Service #1123
Closed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@kohidave kohidave Awaiting requested review from kohidave
2 more reviewers
@efekarakus efekarakus efekarakus approved these changes
@iamhopaul123 iamhopaul123 iamhopaul123 approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@seongm-1 @efekarakus @iamhopaul123
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.