Browse Source

Add personal image with hadolint

master
IamTheFij 2 years ago
parent
commit
becc9bf0b1
  1. 12
      .drone.yml
  2. 8
      Dockerfile.personal
  3. 5
      Makefile
  4. 6
      Readme.md
  5. 6
      scripts/add_hadolint.sh

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

8
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

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

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

6
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
Loading…
Cancel
Save