Newer
Older
###################
# STAGE 1: builder
###################
# Build currently doesn't work on > Java 11 (i18n utils are busted) so build on 8 until we fix this
FROM adoptopenjdk/openjdk8:alpine as builder
Allen Gilliland
committed
Allen Gilliland
committed
# curl: needed by script that installs Clojure CLI
# java-cacerts: installs updated cacerts to /etc/ssl/certs/java/cacerts
RUN apk add --no-cache coreutils bash yarn git curl gettext java-cacerts
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
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
# backend dependencies
RUN lein deps
# frontend dependencies
Allen Gilliland
committed
Allen Gilliland
committed
Allen Gilliland
committed
# build the app
Allen Gilliland
committed
# import AWS RDS cert into /etc/ssl/certs/java/cacerts
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
# ###################
# # STAGE 2: runner
# ###################
FROM adoptopenjdk/openjdk11:alpine-jre as runner
RUN apk -U upgrade && apk add --no-cache bash ttf-dejavu fontconfig
COPY --from=builder /etc/ssl/certs/java/cacerts /opt/java/openjdk/lib/security/cacerts
# add Metabase script and uberjar
RUN mkdir -p bin target/uberjar
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 && chmod a+rwx /plugins
Allen Gilliland
committed
# expose our default runtime port
EXPOSE 3000