Skip to content

Commit 01d262c

Browse files
authored
fix: pre-build docker image (antonbabenko#292)
1 parent 31e7ccf commit 01d262c

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

.github/workflows/build-image.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333
uses: docker/build-push-action@v2
3434
with:
3535
context: .
36+
build-args: |
37+
INSTALL_ALL=true
3638
platforms: linux/amd64
3739
push: true
3840
tags: |

Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
ARG TAG=3.9.7-alpine3.14
22
FROM python:${TAG} as builder
33

4-
ENV PYTHONUNBUFFERED 1
5-
64
WORKDIR /bin_dir
75

86
RUN apk add --no-cache \

README.md

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Want to contribute? Check [open issues](https://github.com/antonbabenko/pre-comm
66

77
## Sponsors
88

9+
<!-- markdownlint-disable no-inline-html -->
10+
911
<br />
1012
<a href="https://www.env0.com/?utm_campaign=pre-commit-terraform&utm_source=sponsorship&utm_medium=social"><img src="https://raw.githubusercontent.com/antonbabenko/pre-commit-terraform/master/assets/env0.png" alt="env0" width="180" height="44" />
1113

@@ -14,10 +16,13 @@ Automated provisioning of Terraform workflows and Infrastructure as Code.</a>
1416
<br />
1517
<a href="https://www.infracost.io/?utm_campaign=pre-commit-terraform&utm_source=sponsorship&utm_medium=social"><img src="https://raw.githubusercontent.com/antonbabenko/pre-commit-terraform/master/assets/infracost.png" alt="infracost" width="200" height="38" />
1618

19+
<!-- markdownlint-enable no-inline-html -->
20+
1721
Cloud cost estimates for Terraform.</a>
1822

1923
If you are using `pre-commit-terraform` already or want to support its development and [many other open-source projects](https://github.com/antonbabenko/terraform-aws-devops), please become a [GitHub Sponsor](https://github.com/sponsors/antonbabenko)!
2024

25+
2126
## Table of content
2227

2328
* [Sponsors](#sponsors)
@@ -59,19 +64,30 @@ If you are using `pre-commit-terraform` already or want to support its developme
5964

6065
<details><summary><b>Docker</b></summary><br>
6166

62-
When `--build-arg` is not specified, the latest version of `pre-commit` and `terraform` will be installed.
67+
**Pull docker image with all hooks**:
68+
69+
```bash
70+
TAG=latest
71+
docker pull ghcr.io/antonbabenko/pre-commit-terraform:$TAG
72+
```
73+
74+
All available tags [here](https://github.com/antonbabenko/pre-commit-terraform/pkgs/container/pre-commit-terraform/versions).
75+
76+
**Build from scratch**:
77+
78+
When `--build-arg` is not specified, the latest version of `pre-commit` and `terraform` will be only installed.
6379

6480
```bash
6581
git clone [email protected]:antonbabenko/pre-commit-terraform.git
6682
cd pre-commit-terraform
6783
# Install the latest versions of all the tools
68-
docker build -t pre-commit --build-arg INSTALL_ALL=true .
84+
docker build -t pre-commit-terraform --build-arg INSTALL_ALL=true .
6985
```
7086

7187
To install a specific version of individual tools, define it using `--build-arg` arguments or set it to `latest`:
7288

7389
```bash
74-
docker build -t pre-commit \
90+
docker build -t pre-commit-terraform \
7591
--build-arg PRE_COMMIT_VERSION=latest \
7692
--build-arg TERRAFORM_VERSION=latest \
7793
--build-arg CHECKOV_VERSION=2.0.405 \
@@ -174,15 +190,18 @@ Execute this command to run `pre-commit` on all files in the repository (not onl
174190
pre-commit run -a
175191
```
176192

177-
Or, using Docker:
193+
Or, using Docker ([available tags](https://github.com/antonbabenko/pre-commit-terraform/pkgs/container/pre-commit-terraform/versions)):
178194

179195
```bash
180-
docker run -v $(pwd):/lint -w /lint pre-commit run -a
196+
TAG=latest
197+
docker run -v $(pwd):/lint -w /lint ghcr.io/antonbabenko/pre-commit-terraform:$TAG run -a
181198
```
182199

183200
Execute this command to list the versions of the tools in Docker:
201+
184202
```bash
185-
docker run --entrypoint cat pre-commit:latest /usr/bin/tools_versions_info
203+
TAG=latest
204+
docker run --entrypoint cat ghcr.io/antonbabenko/pre-commit-terraform:$TAG /usr/bin/tools_versions_info
186205
```
187206

188207
## Available Hooks
@@ -321,7 +340,7 @@ Unlike most other hooks, this hook triggers once if there are any changed files
321340
2. It is possible to pass additional arguments to shell scripts when using `terraform_docs` and `terraform_docs_without_aggregate_type_defaults`.
322341

323342
3. It is possible to automatically:
324-
* create documentation file
343+
* create a documentation file
325344
* extend existing documentation file by appending markers to the end of the file (see item 1 above)
326345
* use different filename for the documentation (default is `README.md`)
327346

@@ -333,7 +352,7 @@ Unlike most other hooks, this hook triggers once if there are any changed files
333352
- --hook-config=--create-file-if-not-exist=true # Boolean. true or false
334353
```
335354

336-
4. You can provide [any configuration available in `terraform-docs`](https://terraform-docs.io/user-guide/configuration/) as argument to `terraform_doc` hook, for example:
355+
4. You can provide [any configuration available in `terraform-docs`](https://terraform-docs.io/user-guide/configuration/) as an argument to `terraform_doc` hook, for example:
337356

338357
```yaml
339358
- id: terraform_docs

0 commit comments

Comments
 (0)