From 7bebe28b01ce8832cd6408ff3bb2baedace1aa6c Mon Sep 17 00:00:00 2001 From: surtur Date: Wed, 20 Apr 2022 22:16:47 +0200 Subject: [PATCH] initial commit --- .hadolint.yaml | 2 ++ .pre-commit-config.yaml | 7 +++++++ Containerfile | 27 +++++++++++++++++++++++++++ LICENSE | 21 +++++++++++++++++++++ Makefile | 35 +++++++++++++++++++++++++++++++++++ README.md | 8 ++++++++ 6 files changed, 100 insertions(+) create mode 100644 .hadolint.yaml create mode 100644 .pre-commit-config.yaml create mode 100644 Containerfile create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 README.md diff --git a/.hadolint.yaml b/.hadolint.yaml new file mode 100644 index 0000000..3cc5e59 --- /dev/null +++ b/.hadolint.yaml @@ -0,0 +1,2 @@ +--- +ignored: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..1fe2015 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,7 @@ +--- +fail_fast: false +repos: + - repo: https://git.dotya.ml/wanderer/hadolint-pre-commit + rev: v0.0.1 + hooks: + - id: hadolint-container diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..1b77ceb --- /dev/null +++ b/Containerfile @@ -0,0 +1,27 @@ +# syntax=docker/dockerfile:1.3 +FROM registry.fedoraproject.org/fedora-minimal:36 + +ARG BUILD_DATE +ARG VCS_REF + +LABEL description="Container image based on fedora-minimal, hourly updated, serving as a base image for other projects" + +LABEL org.label-schema.build-date=$BUILD_DATE \ + org.label-schema.vcs-url="https://git.dotya.ml/wanderer/fedora-minimal.git" \ + org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.license=GPL-3.0 + +# DL3041 warning: Specify version with `dnf install -y -`. +# hadolint ignore=DL3041 +RUN microdnf --refresh upgrade -y && \ + microdnf install -y --nodocs --setopt install_weak_deps=0 \ + findutils \ + && microdnf clean all -y; \ + \ + rm -rf /usr/share/zoneinfo/*; rm -rf /usr/include/*; \ + find /. -name "*~" -type f -delete > /dev/null 2>&1; \ + find /usr/share/terminfo/. -type f -delete \ + ! -name "*xterm*" ! -name "*screen*" ! -name "*screen*" +WORKDIR / + +# vim: ft=dockerfile diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..5acc696 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Adam Mirre + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0629f41 --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +dcmd = podman +dfile = Containerfile +dtag = immawanderer/fedora-minimal:testbuild +dargs = build -t $(dtag) --no-cache --pull - < $(dfile) +cleanargs = image rm -f $(dtag) +pruneargs = system prune -af +dargskaniko = run --rm -it -w=$(kanikowdir) -v $$PWD:$(kanikowdir):ro +kanikoexecutorimg = gcr.io/kaniko-project/executor:v1.8.1-debug +kanikowdir = /src +kanikocontext = . +kanikoargs = -f=$(dfile) -c=$(kanikocontext) --use-new-run --snapshotMode=redo --build-arg BUILD_DATE=$(build_date) --build-arg VCS_REF=$(vcs_ref) --no-push +vcs_ref = $$(git rev-parse --short HEAD) +build_date= $$(date -u +"%Y-%m-%dT%H:%M:%SZ") +hadolintimg = ghcr.io/hadolint/hadolint +hadolinttag = v2.10.0-alpine +hadolintargs = run --rm -i -v $$PWD:/src:ro --workdir=/src + +.PHONY: hadolint build kaniko clean test prune + +hadolint: + $(dcmd) $(hadolintargs) $(hadolintimg):$(hadolinttag) < $(dfile) + +kaniko: + $(dcmd) $(dargskaniko) $(kanikoexecutorimg) $(kanikoargs) + +build: + $(dcmd) $(dargs) + +clean: + $(dcmd) $(cleanargs) + +test: hadolint build kaniko + +prune: + $(dcmd) $(pruneargs) diff --git a/README.md b/README.md new file mode 100644 index 0000000..9bb5ffc --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# fedora-minimal +[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit) + +this repo provides a Containerfile to build a container image based on +fedora-minimal, hourly updated, serving as a base image for other projects + +### LICENSE +MIT