Make cAdvisor Dockerimage much smaller.
Remove old Dockerfiles for deployment and create a new one that only includes the statically linked binaries we need. This creates an image that is ~22MB in size.
This commit is contained in:
parent
dbdf92359a
commit
93754d77ee
11
deploy/Dockerfile
Normal file
11
deploy/Dockerfile
Normal file
@ -0,0 +1,11 @@
|
||||
FROM scratch
|
||||
MAINTAINER dengnan@google.com vmarmol@google.com
|
||||
|
||||
# NOTE: Run prepare.sh before building this Docker image.
|
||||
|
||||
# Grab lmctfy and cadvisor from the staging directory.
|
||||
ADD lmctfy /usr/bin/lmctfy
|
||||
ADD cadvisor /usr/bin/cadvisor
|
||||
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["/usr/bin/cadvisor"]
|
@ -1,9 +0,0 @@
|
||||
FROM busybox:ubuntu-14.04
|
||||
MAINTAINER kyurtsever@google.com dengnan@google.com vmarmol@google.com jason@swindle.me
|
||||
|
||||
# Get cAdvisor binaries.
|
||||
ADD http://storage.googleapis.com/cadvisor-bin/cadvisor-0.1.3 /usr/bin/cadvisor
|
||||
RUN chmod +x /usr/bin/cadvisor
|
||||
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["/usr/bin/cadvisor"]
|
@ -1,14 +0,0 @@
|
||||
FROM ubuntu:14.04
|
||||
MAINTAINER kyurtsever@google.com dengnan@google.com vmarmol@google.com
|
||||
|
||||
# Get the lmctfy dependencies.
|
||||
RUN apt-get update && apt-get install -y -q --no-install-recommends pkg-config libprotobuf8 libapparmor1
|
||||
|
||||
# Get the lcmtfy and cAdvisor binaries.
|
||||
ADD http://storage.googleapis.com/cadvisor-bin/lmctfy/lmctfy /usr/bin/lmctfy
|
||||
ADD http://storage.googleapis.com/cadvisor-bin/lmctfy/libre2.so.0.0.0 /usr/lib/libre2.so.0
|
||||
ADD http://storage.googleapis.com/cadvisor-bin/cadvisor-0.1.3 /usr/bin/cadvisor
|
||||
RUN chmod +x /usr/bin/lmctfy && chmod +x /usr/bin/cadvisor
|
||||
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["/usr/bin/cadvisor"]
|
11
deploy/prepare.sh
Normal file
11
deploy/prepare.sh
Normal file
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
# Download lmctfy.
|
||||
wget http://storage.googleapis.com/cadvisor-bin/lmctfy/lmctfy
|
||||
chmod +x lmctfy
|
||||
|
||||
# Statically build cAdvisor from source and stage it.
|
||||
go build --ldflags '-extldflags "-static"' github.com/google/cadvisor
|
Loading…
Reference in New Issue
Block a user