Merge pull request #662 from justincormack/repeat-ami

Add a base image for building AMIs
This commit is contained in:
Justin Cormack 2016-11-01 13:47:51 +00:00 committed by GitHub
commit 0f357d2ed5
4 changed files with 45 additions and 10 deletions

View File

@ -1,4 +1,4 @@
DIRS = alpine-base alpine-build-c alpine-build-go
DIRS = $(shell find . -type d -depth 1)
.PHONY: clean dirs $(DIRS)
push: $(DIRS)

View File

@ -0,0 +1,14 @@
FROM alpine:3.4
RUN \
apk update && apk upgrade && \
apk add --no-cache \
curl \
e2fsprogs \
jq \
python \
py-pip \
syslinux \
&& true
RUN pip install -U awscli

View File

@ -0,0 +1,29 @@
.PHONY: tag push
BASE=alpine:3.4
IMAGE=alpine-aws
default: push
hash: Dockerfile
docker pull $(BASE)
tar cf - $^ | docker build --no-cache -t $(IMAGE):build -
docker run --rm $(IMAGE):build sh -c '(pip list && cat /lib/apk/db/installed) | sha1sum' | sed 's/ .*//' > hash
push: hash
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
(docker tag $(IMAGE):build mobylinux/$(IMAGE):$(shell cat hash) && \
docker push mobylinux/$(IMAGE):$(shell cat hash))
docker rmi $(IMAGE):build
rm -f hash
tag: hash
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
docker tag $(IMAGE):build mobylinux/$(IMAGE):$(shell cat hash)
docker rmi $(IMAGE):build
rm -f hash
clean:
rm -f hash
.DELETE_ON_ERROR:

View File

@ -1,13 +1,5 @@
FROM alpine
FROM mobylinux/alpine-aws:9f937d52372fc1a8a75b57a305d81ca88c522f78
RUN apk add --update \
python \
py-pip \
curl \
e2fsprogs \
jq \
syslinux
RUN pip install -U awscli
RUN mkdir /build
RUN mkdir /scripts
WORKDIR /scripts