From c61172cdc23ae349ad57e70e0de22dd91677fba4 Mon Sep 17 00:00:00 2001 From: Luis Paolini <paoliniluis@gmail.com> Date: Fri, 29 Jan 2021 22:36:57 -0300 Subject: [PATCH] Trim packages and update (#14585) * Trim packages and update - Removed the make and wget dependency - Made the release container to auto-update - Adds are now a curl in a single command to reduce intermediate images - consecutive run commands into 1 line - ENVs to 1 line to reduce intermediate images * Update the docker file for the releases --- Dockerfile | 31 +++++++++++++------------------ bin/docker/Dockerfile | 15 +++++---------- 2 files changed, 18 insertions(+), 28 deletions(-) diff --git a/Dockerfile b/Dockerfile index c5932bac5ff..c17edd98541 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,29 +7,26 @@ FROM adoptopenjdk/openjdk8:alpine as builder WORKDIR /app/source -ENV FC_LANG en-US -ENV LC_CTYPE en_US.UTF-8 +ENV FC_LANG en-US LC_CTYPE en_US.UTF-8 # bash: various shell scripts -# wget: installing lein (TODO -- is this actually needed? We don't use wget directly) # curl: needed by script that installs Clojure CLI # git: ./bin/version # yarn: frontend building -# make: backend building (TODO -- huh? We don't use Make to build the backend) # gettext: translations # java-cacerts: installs updated cacerts to /etc/ssl/certs/java/cacerts -RUN apk add --no-cache coreutils bash yarn git wget curl make gettext java-cacerts +RUN apk add --no-cache coreutils bash yarn git curl gettext java-cacerts # lein: backend dependencies and building -ADD https://raw.github.com/technomancy/leiningen/stable/bin/lein /usr/local/bin/lein -RUN chmod 744 /usr/local/bin/lein -RUN lein upgrade +RUN curl https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein -o /usr/local/bin/lein && \ + chmod +x /usr/local/bin/lein && \ + /usr/local/bin/lein upgrade # Clojure CLI (needed for some build scripts) -ADD https://download.clojure.org/install/linux-install-1.10.1.708.sh /tmp/linux-install-1.10.1.708.sh -RUN chmod +x /tmp/linux-install-1.10.1.708.sh -RUN /tmp/linux-install-1.10.1.708.sh +RUN curl https://download.clojure.org/install/linux-install-1.10.1.708.sh -o /tmp/linux-install-1.10.1.708.sh && \ + chmod +x /tmp/linux-install-1.10.1.708.sh && \ + sh /tmp/linux-install-1.10.1.708.sh # install dependencies before adding the rest of the source to maximize caching @@ -48,8 +45,8 @@ COPY . . RUN INTERACTIVE=false bin/build # import AWS RDS cert into /etc/ssl/certs/java/cacerts -ADD https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem . -RUN keytool -noprompt -import -trustcacerts -alias aws-rds \ +RUN curl https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem -o rds-combined-ca-bundle.pem && \ + /opt/java/openjdk/bin/keytool -noprompt -import -trustcacerts -alias aws-rds \ -file rds-combined-ca-bundle.pem \ -keystore /etc/ssl/certs/java/cacerts \ -keypass changeit -storepass changeit @@ -62,11 +59,10 @@ FROM adoptopenjdk/openjdk11:alpine-jre as runner WORKDIR /app -ENV FC_LANG en-US -ENV LC_CTYPE en_US.UTF-8 +ENV FC_LANG en-US LC_CTYPE en_US.UTF-8 # dependencies -RUN apk add --no-cache bash ttf-dejavu fontconfig +RUN apk -U upgrade && apk add --no-cache bash ttf-dejavu fontconfig # add fixed cacerts COPY --from=builder /etc/ssl/certs/java/cacerts /opt/java/openjdk/lib/security/cacerts @@ -77,8 +73,7 @@ COPY --from=builder /app/source/target/uberjar/metabase.jar /app/target/uberjar/ COPY --from=builder /app/source/bin/start /app/bin/ # create the plugins directory, with writable permissions -RUN mkdir -p /plugins -RUN chmod a+rwx /plugins +RUN mkdir -p /plugins && chmod a+rwx /plugins # expose our default runtime port EXPOSE 3000 diff --git a/bin/docker/Dockerfile b/bin/docker/Dockerfile index bdc1cb0a9fe..99b36abbfce 100644 --- a/bin/docker/Dockerfile +++ b/bin/docker/Dockerfile @@ -1,20 +1,15 @@ FROM adoptopenjdk/openjdk11:alpine-jre -ENV FC_LANG en-US -ENV LC_CTYPE en_US.UTF-8 +ENV FC_LANG en-US LC_CTYPE en_US.UTF-8 # dependencies -RUN apk add --update --no-cache bash ttf-dejavu fontconfig +RUN apk -U upgrade && apk add --update --no-cache bash ttf-dejavu fontconfig -# add Metabase jar -COPY ./metabase.jar /app/ - -# add our run script to the image -COPY ./run_metabase.sh /app/ +# add Metabase jar & add our run script to the image +COPY ./metabase.jar ./run_metabase.sh /app/ # create the plugins directory, with writable permissions -RUN mkdir -p /plugins -RUN chmod a+rwx /plugins +RUN mkdir -p /plugins && chmod a+rwx /plugins # expose our default runtime port EXPOSE 3000 -- GitLab