Skip to content

Commit

Permalink
Merge pull request google#2576 from iwankgb/docker_build_on_arm
Browse files Browse the repository at this point in the history
Using multistage Dockerfile and upgrading Alpine to 3.12
  • Loading branch information
dashpole authored Jun 8, 2020
2 parents 6c8da92 + bcd6c9c commit bd8c4d1
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions deploy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
FROM alpine:3.10
MAINTAINER dengnan@google.com vmarmol@google.com vishnuk@google.com jimmidyson@gmail.com stclair@google.com
FROM alpine:3.12 AS build

RUN apk --no-cache add libc6-compat device-mapper findutils zfs build-base linux-headers && \
RUN apk --no-cache add libc6-compat device-mapper findutils zfs build-base linux-headers go bash git && \
apk --no-cache add thin-provisioning-tools --repository http://dl-3.alpinelinux.org/alpine/edge/main/ && \
echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf && \
rm -rf /var/cache/apk/*
Expand All @@ -14,8 +13,30 @@ RUN export DBG="-g -Wall" && \
make -e -C libpfm-4.10.1 && \
make install -C libpfm-4.10.1

# Grab cadvisor from the staging directory.
ADD cadvisor /usr/bin/cadvisor
RUN export DBG="-g -Wall" && \
make -e -C libpfm-4.10.1 && \
make install -C libpfm-4.10.1

ADD . /go/src/github.com/google/cadvisor
WORKDIR /go/src/github.com/google/cadvisor

ENV GOROOT /usr/lib/go
ENV GOPATH /go
ENV GO_FLAGS="-tags=libpfm,netgo"
RUN ./build/build.sh


FROM alpine:3.12
MAINTAINER dengnan@google.com vmarmol@google.com vishnuk@google.com jimmidyson@gmail.com stclair@google.com

RUN apk --no-cache add libc6-compat device-mapper findutils zfs && \
apk --no-cache add thin-provisioning-tools --repository http://dl-3.alpinelinux.org/alpine/edge/main/ && \
echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf && \
rm -rf /var/cache/apk/*

# Grab cadvisor and libpfm4 from "build" container.
COPY --from=build /usr/local/lib/libpfm.so* /usr/local/lib/
COPY --from=build /go/src/github.com/google/cadvisor/cadvisor /usr/bin/cadvisor

EXPOSE 8080

Expand Down

0 comments on commit bd8c4d1

Please sign in to comment.