From 57d0925a21948b91c44d9229752729f429c2fe4d Mon Sep 17 00:00:00 2001 From: shnee Date: Sat, 14 May 2022 14:34:23 -0400 Subject: [PATCH] 19.03 works, scaffolding started for more versions. --- .drone.yml | 5 +++++ Dockerfile | 6 ++++-- Makefile | 44 ++++++++++++++++++++++++++++++++------------ 3 files changed, 41 insertions(+), 14 deletions(-) diff --git a/.drone.yml b/.drone.yml index 1d3a358..3dd8194 100644 --- a/.drone.yml +++ b/.drone.yml @@ -5,6 +5,11 @@ name: docker-build steps: - name: docker build + # When using 20.10 there is an issue when running on hosts with older + # versions of docker, runc, and libseccomp. See + # https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.14.0#faccessat2 + # for info on the issue. So to avoid the bug we're using an older version, + # 19.03. image: shnee/dind volumes: - name: dockersock diff --git a/Dockerfile b/Dockerfile index 1d05ab0..e0932c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ -# FROM docker:dind -FROM docker:19.03-dind +ARG DOCKER_VERSION=19.03 +ARG BASE_IMAGE_TAG=$DOCKER_VERSION-dind + +FROM docker:$BASE_IMAGE_TAG RUN apk add --no-cache \ make diff --git a/Makefile b/Makefile index 88aa8a9..77b3218 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,41 @@ -default: build +default: 19.03 -DATE = $(shell date +%F) -SHORT_COMMIT_HASH = $(shell git log -1 --format=%h) +IMAGE_NAME := shnee/dind +DOCKER_VERSION = "" -build: - docker build . -t shnee/dind:latest +DATE := $(shell date +%F) +SHORT_COMMIT_HASH := $(shell git log -1 --format=%h) -tag: - docker tag shnee/dind:latest shnee/dind:$(DATE)-$(SHORT_COMMIT_HASH) +UNIQUE_TAG = $(DOCKER_VERSION)-$(DATE)-$(SHORT_COMMIT_HASH) -clean: rm-unique - -docker rmi shnee/dind:latest +# When using 20.10 there is an issue when running on hosts with older versions +# of docker, runc, and libseccomp. See +# https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.14.0#faccessat2 +# for info on the issue. So to avoid the bug we're using an older version, +# 19.03. +build: 19.03 +# TODO See if we can keep this makefile generic and have an include directory +# for specific stuff. +19.03: 19.03-vars docker-build -rm-unique: - -docker rmi shnee/dind:$(DATE)-$(SHORT_COMMIT_HASH) +19.03-clean: 19.03-vars docker-rm + +19.03-vars: + $(eval DOCKER_VERSION = 19.03) + $(eval DOCKER_TAG = 19.03) + +docker-build: + docker build . \ + -t $(IMAGE_NAME):$(DOCKER_TAG) + +clean: clean-all +clean-all: 19.03-clean + +docker-rm: + docker rmi $(IMAGE_NAME):$(DOCKER_TAG) help: @echo TODO REM do me. -.PHONY: default build tag clean rm-unique help +.PHONY: 19.03 19.03-clean 19.03-vars +.PHONY: default build tag clean clean-all docker-rm help