From fd90632ef2aaf42a4ae972dbf99a8497451c4dcd Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Mon, 10 Apr 2017 17:19:21 +0200 Subject: [PATCH] Add task to push local image --- .gitignore | 1 + Dockerfile | 2 +- Makefile | 15 +++++++++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index e1925bd..a583ac7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *~ *.orig /.idea +/archlinux.tar diff --git a/Dockerfile b/Dockerfile index 1af633c..eb356d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,3 @@ FROM scratch -ADD archlinux.tar.xz / +ADD archlinux.tar / CMD ["/usr/bin/bash"] diff --git a/Makefile b/Makefile index 567a75f..bc76895 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,21 @@ +DOCKER_USER := 'pierres' +DOCKER_IMAGE := 'archlinux' + rootfs: $(eval TMPDIR := $(shell mktemp -d)) pacstrap -C /usr/share/devtools/pacman-extra.conf -c -d -G -M $(TMPDIR) $(shell cat packages) - cp -rvp --backup --suffix=.pacnew rootfs/* $(TMPDIR)/ + cp -rp --backup --suffix=.pacnew rootfs/* $(TMPDIR)/ arch-chroot $(TMPDIR) locale-gen arch-chroot $(TMPDIR) pacman-key --init arch-chroot $(TMPDIR) pacman-key --populate archlinux - tar --numeric-owner --xattrs --acls --exclude-from=exclude -C $(TMPDIR) -c . -Jvf archlinux.tar.xz + tar --numeric-owner --xattrs --acls --exclude-from=exclude -C $(TMPDIR) -c . -f archlinux.tar rm -rf $(TMPDIR) docker-image: rootfs - docker build -t pierres/archlinux . + docker build -t $(DOCKER_USER)/$(DOCKER_IMAGE) . -.PHONY: rootfs docker-image +docker-push: docker-image + docker login -u $(DOCKER_USER) + docker push $(DOCKER_USER)/$(DOCKER_IMAGE) + +.PHONY: rootfs docker-image docker-push