-
-
Notifications
You must be signed in to change notification settings - Fork 980
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
Adds a Dockerfile that creates a terragrunt image #1665
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
FROM golang:1.16.3-alpine as builder | ||
|
||
RUN apk add --update --no-cache make git | ||
|
||
WORKDIR /go/src/terragrunt | ||
|
||
# Download modules in a separate layer so docker caches it, to reduce build time | ||
# when modules have not changed. | ||
COPY go.mod . | ||
COPY go.sum . | ||
RUN go mod download -x | ||
|
||
COPY . . | ||
|
||
RUN make build | ||
|
||
### | ||
|
||
FROM alpine:latest | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NIT: couldn't this be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps? Using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The scratch base image worked, just needed to use
|
||
|
||
COPY --from=builder /go/src/terragrunt/terragrunt /usr/local/bin/ | ||
|
||
ENTRYPOINT terragrunt |
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.
This will end up with an empty version number in the binary. It needs to be set via:
But it's not clear what version number we'd be able to use?
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.
The version is not empty! That's one reason I used the
make build
target. The version is determined by the commandgit describe --tags --abbrev=12 --dirty --broken
. When the checkout matches a git tag, the value is just the git tag. When the checkout is not a tag, you get the last tag plus a git ref marker.If you go with the dockerhub build service, dockerhub clones the repo and has all the tags, so this evaluates correctly. I'd expect any other container build service would also.
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.
For example: