Skip to content

Commit

Permalink
3.5: remove the dependency on busybox
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Wang <[email protected]>
  • Loading branch information
ahrtr committed Dec 23, 2022
1 parent f12f162 commit 1293f5d
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 32 deletions.
14 changes: 5 additions & 9 deletions Dockerfile-release.amd64
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
FROM --platform=linux/amd64 busybox:1.34.1 as source
FROM --platform=linux/amd64 gcr.io/distroless/base-debian11

COPY --from=source /bin/sh /bin/sh
COPY --from=source /bin/mkdir /bin/mkdir
FROM --platform=linux/amd64 gcr.io/distroless/static-debian11

ADD etcd /usr/local/bin/
ADD etcdctl /usr/local/bin/
ADD etcdutl /usr/local/bin/
RUN mkdir -p /var/etcd/
RUN mkdir -p /var/lib/etcd/

WORKDIR /var/etcd/
WORKDIR /var/lib/etcd/

# Alpine Linux doesn't use pam, which means that there is no /etc/nsswitch.conf,
# but Golang relies on /etc/nsswitch.conf to check the order of DNS resolving
# (see https://github.com/golang/go/commit/9dee7771f561cf6aee081c0af6658cc81fac3918)
# To fix this we just create /etc/nsswitch.conf and add the following line:
RUN echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf
ADD nsswitch.conf /etc/nsswitch.conf

EXPOSE 2379 2380

Expand Down
12 changes: 4 additions & 8 deletions Dockerfile-release.arm64
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
FROM --platform=linux/arm64 busybox:1.34.1 as source
FROM --platform=linux/arm64 gcr.io/distroless/base-debian11

COPY --from=source /bin/sh /bin/sh
COPY --from=source /bin/mkdir /bin/mkdir
FROM --platform=linux/arm64 gcr.io/distroless/static-debian11

ADD etcd /usr/local/bin/
ADD etcdctl /usr/local/bin/
ADD etcdutl /usr/local/bin/
ADD var/etcd /var/etcd
ADD var/lib/etcd /var/lib/etcd
ENV ETCD_UNSUPPORTED_ARCH=arm64

WORKDIR /var/etcd/
WORKDIR /var/lib/etcd/

EXPOSE 2379 2380

Expand Down
11 changes: 4 additions & 7 deletions Dockerfile-release.ppc64le
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
FROM --platform=linux/ppc64le busybox:1.34.1 as source
FROM --platform=linux/ppc64le gcr.io/distroless/base-debian11

COPY --from=source /bin/sh /bin/sh
COPY --from=source /bin/mkdir /bin/mkdir
FROM --platform=linux/ppc64le gcr.io/distroless/static-debian11

ADD etcd /usr/local/bin/
ADD etcdctl /usr/local/bin/
ADD etcdutl /usr/local/bin/
ADD var/etcd /var/etcd
ADD var/lib/etcd /var/lib/etcd

WORKDIR /var/etcd/
WORKDIR /var/lib/etcd/

EXPOSE 2379 2380

Expand Down
12 changes: 4 additions & 8 deletions Dockerfile-release.s390x
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
FROM --platform=linux/s390x busybox:1.34.1 as source
FROM --platform=linux/s390x gcr.io/distroless/base-debian11

COPY --from=source /bin/sh /bin/sh
COPY --from=source /bin/mkdir /bin/mkdir

FROM --platform=linux/s390x gcr.io/distroless/static-debian11

ADD etcd /usr/local/bin/
ADD etcdctl /usr/local/bin/
ADD etcdutl /usr/local/bin/
ADD var/etcd /var/etcd
ADD var/lib/etcd /var/lib/etcd

WORKDIR /var/etcd/
WORKDIR /var/lib/etcd/

EXPOSE 2379 2380

Expand Down
2 changes: 2 additions & 0 deletions nsswitch.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4

2 changes: 2 additions & 0 deletions scripts/build-docker
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ mkdir -p "${IMAGEDIR}"/var/etcd
mkdir -p "${IMAGEDIR}"/var/lib/etcd
cp "${BINARYDIR}"/etcd "${BINARYDIR}"/etcdctl "${BINARYDIR}"/etcdutl "${IMAGEDIR}"

cp ./nsswitch.conf "${IMAGEDIR}"

cat ./"${DOCKERFILE}" > "${IMAGEDIR}"/Dockerfile

if [ -z "$TAG" ]; then
Expand Down

0 comments on commit 1293f5d

Please sign in to comment.