Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Optimize Docker cache usage for flux and helm-operator docker images.
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Jul 3, 2018
1 parent 9d5eb91 commit c02113a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 20 deletions.
25 changes: 15 additions & 10 deletions docker/Dockerfile.flux
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
FROM alpine:3.6

WORKDIR /home/flux

RUN apk add --no-cache openssh ca-certificates tini 'git>=2.3.0'

# Add git hosts to known hosts file so when git ssh's using the deploy
# key we don't get an unknown host warning.
RUN mkdir ~/.ssh && touch ~/.ssh/known_hosts && \
ssh-keyscan github.com gitlab.com bitbucket.org >> ~/.ssh/known_hosts && \
chmod 600 ~/.ssh/known_hosts
# Add default SSH config, which points at the private key we'll mount
COPY ./ssh_config /root/.ssh/config
RUN chmod 600 /root/.ssh/config

COPY ./kubectl /usr/local/bin/

# These are pretty static
LABEL maintainer="Weaveworks <[email protected]>" \
org.opencontainers.image.title="flux" \
Expand All @@ -14,22 +29,12 @@ LABEL maintainer="Weaveworks <[email protected]>" \
org.label-schema.vcs-url="[email protected]:weaveworks/flux" \
org.label-schema.vendor="Weaveworks"

WORKDIR /home/flux
ENTRYPOINT [ "/sbin/tini", "--", "fluxd" ]
RUN apk add --no-cache openssh ca-certificates tini 'git>=2.3.0'

# Get the kubeyaml binary (files) and put them on the path
COPY --from=quay.io/squaremo/kubeyaml:0.3.2 /usr/lib/kubeyaml /usr/lib/kubeyaml/
ENV PATH=/bin:/usr/bin:/usr/local/bin:/usr/lib/kubeyaml

# Add git hosts to known hosts file so we can use
# StrickHostKeyChecking with git+ssh
RUN ssh-keyscan github.com gitlab.com bitbucket.org >> /etc/ssh/ssh_known_hosts
# Add default SSH config, which points at the private key we'll mount
COPY ./ssh_config /etc/ssh/ssh_config

COPY ./kubeconfig /root/.kube/config
COPY ./kubectl /usr/local/bin/
COPY ./fluxd /usr/local/bin/

ARG BUILD_DATE
Expand Down
25 changes: 15 additions & 10 deletions docker/Dockerfile.helm-operator
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
FROM alpine:3.6

WORKDIR /home/flux

RUN apk add --no-cache openssh ca-certificates tini 'git>=2.3.0'

# Add git hosts to known hosts file so when git ssh's using the deploy
# key we don't get an unknown host warning.
RUN mkdir ~/.ssh && touch ~/.ssh/known_hosts && \
ssh-keyscan github.com gitlab.com bitbucket.org >> ~/.ssh/known_hosts && \
chmod 600 ~/.ssh/known_hosts
# Add default SSH config, which points at the private key we'll mount
COPY ./ssh_config /root/.ssh/config
RUN chmod 600 /root/.ssh/config

COPY ./kubectl /usr/local/bin/

# These are pretty static
LABEL maintainer="Weaveworks <[email protected]>" \
org.opencontainers.image.title="flux-helm-operator" \
Expand All @@ -14,18 +29,8 @@ LABEL maintainer="Weaveworks <[email protected]>" \
org.label-schema.vcs-url="[email protected]:weaveworks/flux" \
org.label-schema.vendor="Weaveworks"

WORKDIR /home/flux
ENTRYPOINT [ "/sbin/tini", "--", "helm-operator" ]

RUN apk add --no-cache openssh ca-certificates tini 'git>=2.3.0'

# Add git hosts to known hosts file so we can use
# StrickHostKeyChecking with git+ssh
RUN ssh-keyscan github.com gitlab.com bitbucket.org >> /etc/ssh/ssh_known_hosts
# Add default SSH config, which points at the private key we'll mount
COPY ./ssh_config /etc/ssh/ssh_config

COPY ./kubectl /usr/local/bin/
COPY ./helm-operator /usr/local/bin/

ARG BUILD_DATE
Expand Down

0 comments on commit c02113a

Please sign in to comment.