diff --git a/.drone.yml b/.drone.yml index 504a049..ceefb39 100644 --- a/.drone.yml +++ b/.drone.yml @@ -16,6 +16,18 @@ steps: password: from_secret: docker_password + - name: push personal image + image: plugins/docker + settings: + repo: iamthefij/drone-pre-commit + dockerfile: ./Dockerfile.personal + tags: + - personal + username: + from_secret: docker_username + password: + from_secret: docker_password + --- kind: pipeline name: notify diff --git a/Dockerfile.personal b/Dockerfile.personal new file mode 100644 index 0000000..e067b4a --- /dev/null +++ b/Dockerfile.personal @@ -0,0 +1,8 @@ +ARG BASE_IMAGE=iamthefij/drone-pre-commit +FROM ${BASE_IMAGE}:base + +# Add helper scripts +COPY ./scripts /scripts + +# Bundle hadolint +RUN /scripts/add_hadolint.sh diff --git a/Makefile b/Makefile index acc86ca..bcd2094 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,11 @@ test: build .PHONY: build build: ./Dockerfile docker build -t $(DOCKER_TAG) . + docker tag "$(DOCKER_TAG):latest" "$(DOCKER_TAG):base" + +.PHONY: build-personal +build-personal: build ./Dockerfile.personal + docker build --build-arg "BASE_IMAGE=$(DOCKER_TAG)" -f ./Dockerfile.personal . .PHONY: install-hooks install-hooks: diff --git a/Readme.md b/Readme.md index 36b6df3..f3450dc 100644 --- a/Readme.md +++ b/Readme.md @@ -24,6 +24,12 @@ steps: - pre-commit run --all-files ``` +## Personal image + +A second image is also built for my personal use, but it may be useful to you as well. This image includes the following dependencies: + + * hadolint + ## To Do So far this is basic and unopinionated. Either this will become very personal as I tack on dependencies for the hooks I often use, or it'll become complicated as I add args for everything and build out many tags. I think I'll probbably try to provide some reasonable base image that can then be extended in a new image or as part of one's build pipeline. diff --git a/scripts/add_hadolint.sh b/scripts/add_hadolint.sh new file mode 100755 index 0000000..f1e297f --- /dev/null +++ b/scripts/add_hadolint.sh @@ -0,0 +1,6 @@ +#! /bin/bash +set -ex + +VERSION=v1.18.0 +wget -L -O /usr/bin/hadolint "https://github.com/hadolint/hadolint/releases/download/${VERSION}/hadolint-Linux-x86_64" +chmod +x /usr/bin/hadolint