aboutsummaryrefslogtreecommitdiff
path: root/Makefile.docker
blob: 65f5fe48873d8c22c5e72907663893b4d971ff5a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Makefile for creating and uploading CoreDNS docker image.
#
# First you should do a release and then call this Makefile to create and upload
# the image.
#
# 1. Reuse the issue for this release
# 2. In an issue give the command: /docker VERSION
#    Where VERSION is the version of the release.
# 3. (to test as release /docker -t VERSION can be used.
#
# To release we run, these target from the this Makefile.docker ordered like:
# * make release
# * make docker-push
#
# Testing docker is done e.g. via:
#
# export DOCKER_PASSWORD=<pass>
# export DOCKER_LOGIN=miek
# make VERSION=x.y.z DOCKER=miek -f Makefile.docker release docker-push

ifeq (, $(shell which curl))
    $(error "No curl in $$PATH, please install")
endif
ifeq (, $(shell which jq))
    $(error "No jq in $$PATH, please install")
endif

# VERSION is the version we should download and use.
VERSION:=
# DOCKER is the docker image repo we need to push to.
DOCKER:=
NAME:=coredns
GITHUB:=https://github.com/coredns/coredns/releases/download
# mips is not in LINUX_ARCH because it's not supported by docker manifest. Keep this list in sync with the one in Makefile.release
LINUX_ARCH:=amd64 arm arm64 mips64le ppc64le s390x
DOCKER_IMAGE_NAME:=$(DOCKER)/$(NAME)
DOCKER_IMAGE_LIST_VERSIONED:=$(shell echo $(LINUX_ARCH) | sed -e "s~[^ ]*~$(DOCKER_IMAGE_NAME):&\-$(VERSION)~g")

all:
	@echo Use the 'release' target to download released binaries and build containers per arch, 'docker-push' to build and push a multi arch manifest.
	echo $(DOCKER_IMAGE_LIST_VERSIONED)
	echo $(DOCKER_IMAGE_LIST_LATEST)

release: image-download docker-build

.PHONY: image-download
image-download:
ifeq ($(VERSION),)
	$(error "Please specify a version use. Use VERSION=<version>")
endif

	@# 0. Check until all asset are alive, up to 10 min (asset may not be alive immediately after upload)
	try_max=20; try_sleep=30; \
	for arch in $(LINUX_ARCH); do \
		asset=coredns_$(VERSION)_linux_$${arch}.tgz; \
		for i in $$(seq 1 $$try_max ); do \
			if [ $$(curl -I -L -s -o /dev/null -w "%{http_code}" $(GITHUB)/v$(VERSION)/$$asset) -eq 200 ]; then \
				echo "$$asset is live" ; break; \
			else  \
				echo "$$asset is not live yet..." ; sleep $$try_sleep ; \
			fi ; \
		done ; \
		if [ $$i -eq $$try_max ]; then \
			echo "$$asset is not live after $$try_max tries" ; exit 1; \
		fi ; \
	done
	@rm -rf build/docker
	@mkdir -p build/docker
	@# 1. Copy appropriate coredns binary to build/docker/<arch>
	@# 2. Copy Dockerfile into the correct dir as well.
	@# 3. Unpack the tgz from github into 'coredns' binary.
	for arch in $(LINUX_ARCH); do \
		mkdir build/docker/$${arch}; \
		curl -L $(GITHUB)/v$(VERSION)/coredns_$(VERSION)_linux_$${arch}.tgz > build/docker/$${arch}/coredns.tgz && \
			( cd build/docker/$${arch}; tar xf coredns.tgz && rm coredns.tgz ); \
			cp Dockerfile build/docker/$${arch} ; \
	done

.PHONY: docker-build
docker-build:
ifeq ($(DOCKER),)
	$(error "Please specify Docker registry to use. Use DOCKER=coredns for releases")
else
	docker version
	for arch in $(LINUX_ARCH); do \
	    docker build -t $(DOCKER_IMAGE_NAME):$${arch}-$(VERSION) build/docker/$${arch} ;\
	done
endif

.PHONY: docker-push
docker-push:
ifeq ($(DOCKER),)
	$(error "Please specify Docker registry to use. Use DOCKER=coredns for releases")
else
	@# Pushes coredns/coredns-$arch:$version images
	@# Creates manifest for multi-arch image
	@# Pushes multi-arch image to coredns/coredns:$version
	@echo $(DOCKER_PASSWORD) | docker login -u $(DOCKER_LOGIN) --password-stdin
	@echo Pushing: $(VERSION) to $(DOCKER_IMAGE_NAME)
	for arch in $(LINUX_ARCH); do \
		docker push $(DOCKER_IMAGE_NAME):$${arch}-$(VERSION) ;\
	done
	docker manifest create --amend $(DOCKER_IMAGE_NAME):$(VERSION) $(DOCKER_IMAGE_LIST_VERSIONED)
	docker manifest create --amend $(DOCKER_IMAGE_NAME):latest $(DOCKER_IMAGE_LIST_VERSIONED)
	for arch in $(LINUX_ARCH); do \
		docker manifest annotate --arch $${arch} $(DOCKER_IMAGE_NAME):$(VERSION) $(DOCKER_IMAGE_NAME):$${arch}-$(VERSION) ;\
		docker manifest annotate --arch $${arch} $(DOCKER_IMAGE_NAME):latest $(DOCKER_IMAGE_NAME):$${arch}-$(VERSION) ;\
	done
	docker manifest push --purge $(DOCKER_IMAGE_NAME):$(VERSION)
	docker manifest push --purge $(DOCKER_IMAGE_NAME):latest
	TOKEN=$$(curl -s -H "Content-Type: application/json" -X POST -d "{\"username\":\"$(DOCKER_LOGIN)\",\"password\":\"$(DOCKER_PASSWORD)\"}" "https://hub.docker.com/v2/users/login/" | jq -r .token) ; \
	for arch in $(LINUX_ARCH); do \
		curl -X DELETE -H "Authorization: JWT $${TOKEN}" "https://hub.docker.com/v2/repositories/$(DOCKER_IMAGE_NAME)/tags/$${arch}-$(VERSION)/" ;\
	done
endif
27d8'/>
path: root/examples/framework-alpine/astro.config.mjs (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2022-02-28[ci] update lockfile (#2676)Gravatar Fred K. Schott 1-6/+6
2022-02-28fix(runtime): do not render empty Fragment (#2667)Gravatar Mateus Esdras 1-0/+3
2022-02-28fix(hmr): HMR regression related to .astro updates (#2681)Gravatar Nate Moore 6-7/+24
2022-02-28Fix HTMLElement expression warning (#2675)Gravatar Jonathan Neal 1-1/+1
2022-02-28[ci] collect statsGravatar FredKSchott 1-0/+1
2022-02-27[ci] update lockfile (#2668)Gravatar Fred K. Schott 1-80/+80
2022-02-27[ci] collect statsGravatar FredKSchott 1-0/+1
2022-02-26[ci] collect statsGravatar FredKSchott 1-0/+1
2022-02-25[ci] yarn formatGravatar natemoo-re 1-20/+20
2022-02-25[ci] release (#2666)astro@0.23.2Gravatar github-actions[bot] 32-59/+57
2022-02-25[ci] yarn formatGravatar natemoo-re 2-12/+6
2022-02-25fix astro scoping of "@import" inside of style tags (#2656)Gravatar Fred K. Schott 3-6/+35
2022-02-25[ci] update lockfile (#2659)Gravatar Fred K. Schott 1-20/+20
2022-02-25feat: improve third-party Astro package compatability (#2665)Gravatar Nate Moore 3-6/+100
2022-02-25get new example working during buildGravatar Fred K. Schott 4-16/+21
2022-02-25[ci] yarn formatGravatar FredKSchott 1-7/+6
2022-02-25Add Non-HTML Pages example (#2637)Gravatar Joel Kuzmarski 11-0/+136
2022-02-25[ci] collect statsGravatar FredKSchott 1-0/+1
2022-02-24[ci] yarn formatGravatar natemoo-re 2-24/+24
2022-02-24[ci] release (#2641)astro@0.23.1@astrojs/markdown-remark@0.6.2Gravatar github-actions[bot] 38-90/+81
2022-02-24ensure utf8 encoding when serving html (#2654)Gravatar Fred K. Schott 3-4/+9
2022-02-24fix(core): Issue #2625. error with process.env.LANG larger than 5 (#2645)Gravatar Javier Cortés 2-1/+6
2022-02-24[ci] update lockfile (#2646)Gravatar Fred K. Schott 1-130/+124
2022-02-24chore: upgrade compiler (#2653)Gravatar Nate Moore 3-11/+11
2022-02-24[ci] yarn formatGravatar natemoo-re 2-5/+5
2022-02-24Add fine-grained HMR support (#2649)Gravatar Nate Moore 7-36/+37
2022-02-24[ci] collect statsGravatar FredKSchott 1-0/+1
2022-02-23Fixed incorrect types and imports (#2630)Gravatar Juan Martín Seery 27-35/+37
2022-02-23Add sass dev dep to blog-multiple-authors example (#2643)Gravatar Joel Kuzmarski 1-1/+2
2022-02-23Fix(component): align starting position in Markdown slot (#2631)Gravatar Shinobu Hayashi 4-6/+61
2022-02-23[ci] yarn formatGravatar matthewp 1-1/+1
2022-02-23Run all smoke tests with the static build (#2609)Gravatar Matthew Phillips 2-26/+32
2022-02-23[ci] collect statsGravatar FredKSchott 1-0/+1
2022-02-22[ci] update lockfile (#2624)Gravatar Fred K. Schott 1-171/+201
2022-02-22Fixed shiki import to work with "type": "module" (#2628)Gravatar Juan Martín Seery 3-5/+13