Merge pull request #415 from justincormack/repeatable

[WIP] Make builds repeatable by tagging an image based on hash of package install
This commit is contained in:
Justin Cormack 2016-08-18 10:49:10 +01:00 committed by GitHub
commit 9b95d939d0
4 changed files with 55 additions and 25 deletions

View File

@ -1,34 +1,11 @@
FROM alpine:3.4
FROM justincormack/moby-alpine-base:0d79ff85d10a7d86067a3893e8a1f52ff3a073da
ENV ARCH=x86_64
RUN \
addgroup -g 50 docker && \
adduser -G docker -u 1001 -s /bin/sh -D -g "Docker" docker && \
passwd -d root && \
apk update && apk upgrade && \
apk add \
e2fsprogs \
chrony \
git \
xz \
iptables \
sfdisk \
lvm2 \
syslinux \
openrc \
busybox-initscripts \
alpine-conf \
bind-tools \
openssh-client \
strace \
fuse \
util-linux \
cifs-utils \
e2fsprogs-extra \
openssl \
jq \
&& rm -rf /var/cache/apk/*
passwd -d root
COPY etc /etc/
RUN mkdir -p /etc/docker

1
alpine/base/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
hash

26
alpine/base/Dockerfile Normal file
View File

@ -0,0 +1,26 @@
FROM alpine:3.4
RUN \
apk update && apk upgrade && \
apk add \
e2fsprogs \
chrony \
git \
xz \
iptables \
sfdisk \
lvm2 \
syslinux \
openrc \
busybox-initscripts \
alpine-conf \
bind-tools \
openssh-client \
strace \
fuse \
util-linux \
cifs-utils \
e2fsprogs-extra \
openssl \
jq \
&& rm -rf /var/cache/apk/*

26
alpine/base/Makefile Normal file
View File

@ -0,0 +1,26 @@
.PHONY: tag push
default: push
hash:
docker pull alpine:3.4
tar cf - Dockerfile | docker build --no-cache -t justincormack/moby-alpine-base:build -
rm -f hash
docker run justincormack/moby-alpine-base:build sha1sum /lib/apk/db/installed | sed 's/ .*//' > hash
push: hash
docker pull justincormack/moby-alpine-base:$(shell cat hash) || \
(docker tag justincormack/moby-alpine-base:build justincormack/moby-alpine-base:latest && \
docker tag justincormack/moby-alpine-base:build justincormack/moby-alpine-base:$(shell cat hash) && \
docker push justincormack/moby-alpine-base:$(shell cat hash) && \
docker push justincormack/moby-alpine-base:latest)
rm -f hash
tag: hash
docker pull justincormack/moby-alpine-base:$(shell cat hash) || \
(docker tag justincormack/moby-alpine-base:build justincormack/moby-alpine-base:latest && \
docker tag justincormack/moby-alpine-base:build justincormack/moby-alpine-base:$(shell cat hash))
rm -f hash
clean:
rm -f hash