Commit 0f8bb850 authored by nimrod's avatar nimrod
Browse files

A bunch of things.

- Don't use the builddeps image since it no longer tracks Debian
  testing. Use the same image in all stages of the build (save some
space).
- Install gnupg and curl in the stage that fetches the repos keys.
- Merge the APT installs in the final build stage. There's no need to
  install anything before running apt-get update (once the files are in
place).
- A little nicer handling of GPG keyrings (stole from the Datadog agent
  installation instructions).
parent 485b8d86
Loading
Loading
Loading
Loading
Loading
+19 −13
Original line number Diff line number Diff line
FROM registry.hub.docker.com/library/buildpack-deps:testing as repo-key
FROM docker.io/library/debian:testing-backports as repo-key
# hadolint ignore=DL3008
RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
        ca-certificates \
        curl \
        gnupg \
    && \
    rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/* /var/cache/apt/archives/*
WORKDIR /gnupghome
ENV GNUPGHOME /gnupghome
# hadolint ignore=DL4006
RUN curl https://www.mongodb.org/static/pgp/server-4.4.asc | gpg --dearmor > mongodb.gpg
RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg > google-cloud.gpg
# hadolint ignore=DL4006
RUN curl https://cli-assets.heroku.com/apt/release.key | gpg --dearmor > heroku.gpg
RUN curl https://www.mongodb.org/static/pgp/server-4.4.asc | \
    gpg --no-default-keyring --import --batch --keyring mongodb.gpg
# hadolint ignore=DL4006
RUN curl https://apt.releases.hashicorp.com/gpg | gpg --dearmor > hashicorp.gpg
RUN curl https://cli-assets.heroku.com/apt/release.key | \
    gpg --no-default-keyring --import --batch --keyring heroku.gpg
# hadolint ignore=DL4006
RUN curl https://dl.cloudsmith.io/public/cloudposse/packages/gpg.7333C6FDEFA717CC.key | gpg --dearmor > cloudposse.gpg
RUN curl https://apt.releases.hashicorp.com/gpg | \
    gpg --no-default-keyring --import --batch --keyring hashicorp.gpg
# hadolint ignore=DL4006
RUN curl https://dl.cloudsmith.io/public/cloudposse/packages/gpg.7333C6FDEFA717CC.key | \
    gpg --no-default-keyring --import --batch --keyring cloudposse.gpg

FROM docker.io/library/debian:testing-backports
SHELL ["/bin/bash", "-o", "pipefail", "-xc"]
# hadolint ignore=DL3008
RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
        ca-certificates \
        gnupg \
    && \
    rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/* /var/cache/apt/archives/*
COPY --from=repo-key /gnupghome/mongodb.gpg /usr/share/keyrings/mongodb.gpg
COPY --from=repo-key /gnupghome/google-cloud.gpg /usr/share/keyrings/google-cloud.gpg
COPY --from=repo-key /gnupghome/heroku.gpg /usr/share/keyrings/heroku.gpg
@@ -41,6 +46,7 @@ RUN apt-get update && \
        build-essential \
        bundler \
        bzr \
        ca-certificates \
        cmake \
        composer \
        consul \