Add personal image with hadolint
continuous-integration/drone/push Build is passing Details

This commit is contained in:
IamTheFij 2020-09-08 13:20:54 -07:00
parent 9898c0a9cc
commit becc9bf0b1
5 changed files with 37 additions and 0 deletions

View File

@ -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

8
Dockerfile.personal Normal file
View File

@ -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

View File

@ -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:

View File

@ -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.

6
scripts/add_hadolint.sh Executable file
View File

@ -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