aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorChristian Segundo2022-11-05 21:35:53 +0100
committerChristian Segundo2022-11-05 21:35:53 +0100
commit888da767a63e66b5465f97425344dae036d821cc (patch)
tree51a25a8efbe8e2614ba5ab92f143ed4edbd5b927 /Makefile
downloadnvim-888da767a63e66b5465f97425344dae036d821cc.tar.gz
first commit
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile55
1 files changed, 55 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..fc21b8c
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,55 @@
+PROJECT = docker-nvim
+IMAGE_NAME := ghcr.io/someone-stole-my-name/$(PROJECT)
+IMAGE_PLATFORMS := linux/amd64,linux/arm64
+
+define DOCKER_DEPS
+ binfmt-support \
+ ca-certificates \
+ curl \
+ git \
+ gnupg \
+ jq \
+ lsb-release \
+ make \
+ qemu-user-static \
+ wget
+endef
+
+setup-buildx:
+ curl -fsSL https://download.docker.com/linux/debian/gpg |\
+ gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg && \
+ echo "deb [arch=$(shell dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(shell lsb_release -cs) stable" |\
+ tee /etc/apt/sources.list.d/docker.list > /dev/null && \
+ cat /etc/apt/sources.list.d/docker.list && \
+ apt-get update && \
+ apt-get -qq -y install \
+ docker-ce \
+ docker-ce-cli \
+ containerd.io
+ docker run --privileged --rm tonistiigi/binfmt --install all
+ docker buildx create --name mybuilder
+ docker buildx use mybuilder
+
+push: setup-buildx
+ docker buildx build \
+ --build-arg GOVERSION=$(GOVERSION) \
+ --platform $(IMAGE_PLATFORMS) \
+ -t $(IMAGE_NAME):latest . --push
+ if git describe --exact-match; then \
+ docker buildx build \
+ --build-arg GOVERSION=$(GOVERSION) \
+ --platform $(IMAGE_PLATFORMS) \
+ -t $(IMAGE_NAME):$(shell git describe --tags --abbrev=0) . --push; \
+ fi
+
+export DOCKER_DEPS
+docker-%:
+ docker run \
+ --rm \
+ --privileged \
+ -v /var/run/docker.sock:/var/run/docker.sock \
+ -v $(shell pwd):/data \
+ -w /data $(DOCKER_EXTRA_ARGS) \
+ golang:$(GOVERSION) sh -c "\
+ apt-get update && \
+ apt-get install -y $$DOCKER_DEPS && make $*"