Skip to content
This repository was archived by the owner on Apr 17, 2019. It is now read-only.

Commit e191d4b

Browse files
authored
Merge pull request #1192 from luxas/fix_dnsmasq
Update dnsmasq to 1.3; fix the multiarch build and remove tiny-glibc
2 parents c4221d4 + f773ef1 commit e191d4b

File tree

6 files changed

+25
-116
lines changed

6 files changed

+25
-116
lines changed

dnsmasq/Changelog

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
- First AMD64-only dnsmasq container
33
## Version 1.2 (Wed June 8 2016 Girish Kalele <[email protected]>
44
- Multiple Architecture builds and upgraded to Alpine 3.4
5-
6-
7-
5+
## Version 1.3 (Fri June 11 2016 Lucas Käldström <[email protected]>)
6+
- Patched the multi-architecture images, so they'll work

dnsmasq/Dockerfile.cross

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
# limitations under the License.
1414

1515
FROM BASEIMAGE
16+
# If we're building for another architecture than amd64, the CROSS_BUILD_ placeholder is removed so e.g. CROSS_BUILD_COPY turns into COPY
17+
# If we're building normally, for amd64, CROSS_BUILD lines are removed
18+
CROSS_BUILD_COPY qemu-ARCH-static /usr/bin/
1619
MAINTAINER Girish Kalele <[email protected]>
1720
COPY dnsmasq.conf /etc/dnsmasq.conf
1821
COPY dnsmasq /usr/sbin/dnsmasq
22+
RUN mkdir /var/run/
1923
ENTRYPOINT ["/usr/sbin/dnsmasq", "--keep-in-foreground"]

dnsmasq/Makefile

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,52 +12,61 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# Makefile for the Docker image gcr.io/google_containers/dnsmasq
15+
# Makefile for the Docker image gcr.io/google_containers/kube-dnsmasq-ARCH
1616
# MAINTAINER: Abhishek Shah <[email protected]>
1717
# If you update this image please bump the tag value before pushing.
1818
#
1919
# Usage:
20-
# [TAG=1.0] [REGISTRY=gcr.io/google_containers] [NAMESERVER=127.0.0.1#10053] make container
20+
# [TAG=1.3] [REGISTRY=gcr.io/google_containers] make (build|push)
2121

2222
# Default registry, arch and tag. This can be overwritten by arguments to make
23-
TAG?=1.2
23+
TAG?=1.3
2424
REGISTRY?=gcr.io/google_containers
2525
ARCH?=amd64
2626
KUBE_CROSS_IMAGE:=$(REGISTRY)/kube-cross:v1.6.2-2
2727
DNSMASQ_VERSION?=dnsmasq-2.76
2828
TEMP_DIR:=$(shell mktemp -d)
2929

30-
ifeq ($(ARCH),amd64)
31-
BASEIMAGE?=alpine:3.4
32-
else
33-
BASEIMAGE?=$(REGISTRY)/tiny-glibc-$(ARCH):1.0
34-
endif
35-
3630
ifeq ($(ARCH),arm)
31+
BASEIMAGE?=armel/busybox:glibc
3732
TRIPLE?=arm-linux-gnueabi
33+
QEMUARCH=arm
3834
endif
3935
ifeq ($(ARCH),arm64)
36+
BASEIMAGE?=aarch64/busybox:glibc
4037
TRIPLE?=aarch64-linux-gnu
38+
QEMUARCH=aarch64
4139
endif
4240
ifeq ($(ARCH),ppc64le)
41+
BASEIMAGE?=ppc64le/busybox:glibc
4342
TRIPLE?=powerpc64le-linux-gnu
43+
QEMUARCH=ppc64le
4444
endif
4545

4646
all: build
4747

4848
build:
4949
ifeq ($(ARCH),amd64)
5050
cp Dockerfile $(TEMP_DIR)
51+
# When building "normally" for amd64, remove the whole line, it has no part in the amd64 image
52+
cd $(TEMP_DIR) && sed -i "/CROSS_BUILD_/d" Dockerfile
5153
else
5254
cp Dockerfile.cross $(TEMP_DIR)/Dockerfile
53-
sed -i "s|BASEIMAGE|$(BASEIMAGE)|g" $(TEMP_DIR)/Dockerfile
55+
cd $(TEMP_DIR) && sed -i "s|BASEIMAGE|$(BASEIMAGE)|g" Dockerfile
56+
cd $(TEMP_DIR) && sed -i "s|ARCH|$(QEMUARCH)|g" Dockerfile
5457

5558
# Build the dnsmasq binary using the cross-compilation docker image
5659
docker run -it --rm -v $(TEMP_DIR):/build $(KUBE_CROSS_IMAGE) /bin/bash -c \
5760
"curl -sSL http://www.thekelleys.org.uk/dnsmasq/$(DNSMASQ_VERSION).tar.xz | tar -xJ \
5861
&& cd $(DNSMASQ_VERSION) \
5962
&& CC=$(TRIPLE)-gcc make \
6063
&& cp src/dnsmasq /build"
64+
65+
# When cross-building, only the placeholder "CROSS_BUILD_" should be removed
66+
# Register /usr/bin/qemu-ARCH-static as the handler for ARM binaries in the kernel
67+
docker run --rm --privileged multiarch/qemu-user-static:register --reset
68+
curl -sSL https://github.com/multiarch/qemu-user-static/releases/download/v2.5.0/x86_64_qemu-$(QEMUARCH)-static.tar.xz | tar -xJ -C $(TEMP_DIR)
69+
cd $(TEMP_DIR) && sed -i "s/CROSS_BUILD_//g" Dockerfile
6170
endif
6271
cp dnsmasq.conf $(TEMP_DIR)
6372
docker build -t $(REGISTRY)/kube-dnsmasq-$(ARCH):$(TAG) $(TEMP_DIR)

tiny-glibc/Dockerfile

Lines changed: 0 additions & 2 deletions
This file was deleted.

tiny-glibc/Makefile

Lines changed: 0 additions & 74 deletions
This file was deleted.

tiny-glibc/README.md

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)