-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add dockerfile. add make targets. add sections to the readme.
Signed-off-by: Sergey Yakovlev <[email protected]>
- Loading branch information
1 parent
0dd040f
commit af62438
Showing
3 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
FROM golang:1.16.3-alpine AS builder | ||
|
||
RUN apk add --update --no-cache make | ||
ENV PROJECT_NAME=tfdocs-format-template | ||
ENV SOURCE_DIR=/go/src/${PROJECT_NAME} | ||
# replace tdocs-format-template with actual formatter plugin name. | ||
WORKDIR ${SOURCE_DIR} | ||
|
||
COPY go.mod . | ||
COPY go.sum . | ||
RUN go mod download | ||
|
||
COPY . . | ||
RUN make build | ||
|
||
################ | ||
|
||
FROM quay.io/terraform-docs/terraform-docs:latest | ||
# added because custom plugin should be installed into the $HOME | ||
ENV PROJECT_NAME=tfdocs-format-template | ||
ENV BUILD_CONTAINER_WD=/go/src/${PROJECT_NAME} | ||
ENV USER=docker | ||
ENV UID=12345 | ||
ENV GID=23456 | ||
# creating user in docker container | ||
RUN adduser \ | ||
--disabled-password \ | ||
--gecos "" \ | ||
--home "$(pwd)" \ | ||
--ingroup "root" \ | ||
--uid "$UID" \ | ||
"$USER" | ||
# after this, all commands will be executed from this user | ||
USER docker | ||
|
||
COPY --from=builder ${BUILD_CONTAINER_WD}/bin/linux-amd64/${PROJECT_NAME} $HOME/.tfdocs.d/plugins/${PROJECT_NAME} | ||
|
||
CMD ["/bin/sh","-c","terraform-docs","$@"] |
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
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