Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
019322b2
Unverified
Commit
019322b2
authored
3 years ago
by
Luis Paolini
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Parallel building (frontend & backend) + unify running scripts (#15819)
* Separate steps for faster build * Fix typo
parent
a7998d69
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Dockerfile
+36
-54
36 additions, 54 deletions
Dockerfile
bin/docker/Dockerfile
+2
-3
2 additions, 3 deletions
bin/docker/Dockerfile
with
38 additions
and
57 deletions
Dockerfile
+
36
−
54
View file @
019322b2
...
...
@@ -2,93 +2,79 @@
# STAGE 1.1: builder frontend
###################
FROM
node:12.20.1-alpine
as
frontend
FROM
metabase/ci:java-11-lein-2.9.6-clj-1.10.3.822-04-22-2021
as
frontend
WORKDIR
/app/source
ARG
MB_EDITION=oss
ENV
FC_LANG en-US LC_CTYPE en_US.UTF-8
WORKDIR
/app/source
# frontend dependencies
COPY
yarn.lock package.json .yarnrc ./
RUN
yarn
install
--frozen-lockfile
COPY
. .
RUN
NODE_ENV
=
production
MB_EDITION
=
$MB_EDITION
yarn
--frozen-lockfile
&&
yarn build
&&
bin/i18n/build-translation-resources
###################
# STAGE 1.2:
builder
backend
# STAGE 1.2: backend
deps
###################
FROM
adoptopenjdk/openjdk11:alpine
as
backend
FROM
metabase/ci:java-11-lein-2.9.6-clj-1.10.3.822-04-22-2021
as
backend
WORKDIR
/app/source
ENV
FC_LANG en-US LC_CTYPE en_US.UTF-8
# bash: various shell scripts
# curl: needed by script that installs Clojure CLI
RUN
apk add
--no-cache
curl bash
# lein: backend dependencies and building
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
# backend dependencies
COPY
project.clj .
RUN
lein deps
RUN
lein deps
:tree
###################
# STAGE 1.3:
main build
er
# STAGE 1.3:
driv
er
s
###################
FROM
adoptopenjdk/openjdk11:alpine
as
build
er
FROM
metabase/ci:java-11-lein-2.9.6-clj-1.10.3.822-04-22-2021
as
driv
er
s
ARG
MB_EDITION=oss
WORKDIR
/app/source
ENV
FC_LANG en-US LC_CTYPE en_US.UTF-8
COPY
--from=backend /root/.m2/repository/. /root/.m2/repository/.
# add the rest of the source
COPY
. .
# bash: various shell scripts
# curl: needed by script that installs Clojure CLI
# git: ./bin/version
# yarn: frontend building
# java-cacerts: installs updated cacerts to /etc/ssl/certs/java/cacerts
# build the app
RUN
INTERACTIVE
=
false
MB_EDITION
=
$MB_EDITION
sh bin/build-drivers.sh
RUN
apk add
--no-cache
coreutils bash yarn git curl java-cacerts
###################
# STAGE 1.4: main builder
###################
# lein: backend dependencies and building
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
FROM
metabase/ci:java-11-lein-2.9.6-clj-1.10.3.822-04-22-2021
as
builder
# Clojure CLI (needed for some build scripts)
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
ARG
MB_EDITION=oss
WORKDIR
/app/source
# try to reuse caching as much as possible
COPY
--from=frontend /root/.m2/repository/. /root/.m2/repository/.
COPY
--from=frontend /app/source/. .
COPY
--from=backend /root/.m2/repository/. /root/.m2/repository/.
COPY
--from=backend /app/source/. .
COPY
--from=backend /root/. /root/
# add the rest of the source
COPY
. .
COPY
--from=drivers /root/.m2/repository/. /root/.m2/repository/.
COPY
--from=drivers /app/source/. .
# build the app
RUN
INTERACTIVE
=
false
MB_EDITION
=
$MB_EDITION
bin/build
RUN
INTERACTIVE
=
false
MB_EDITION
=
$MB_EDITION
bin/build
uberjar
# ###################
# # STAGE 2: runner
# ###################
FROM
adoptopenjdk/openjdk11:alpine-jre
as
runner
## Remember that this runner image needs to be the same as bin/docker/Dockerfile with the exception that this one grabs the
## jar from the previous stage rather than the local build
WORKDIR
/app
FROM
adoptopenjdk/openjdk11:alpine-jre
as
runner
ENV
FC_LANG en-US LC_CTYPE en_US.UTF-8
# dependencies
RUN
apk
-U
upgrade
&&
\
apk add
--update
--no-cache
bash ttf-dejavu fontconfig curl java-cacerts
&&
\
RUN
apk upgrade
&&
apk add
--update-cache
--no-cache
bash ttf-dejavu fontconfig curl java-cacerts
&&
\
mkdir
-p
/app/certs
&&
\
curl https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem
-o
/app/certs/rds-combined-ca-bundle.pem
&&
\
/opt/java/openjdk/bin/keytool
-noprompt
-import
-trustcacerts
-alias
aws-rds
-file
/app/certs/rds-combined-ca-bundle.pem
-keystore
/etc/ssl/certs/java/cacerts
-keypass
changeit
-storepass
changeit
&&
\
...
...
@@ -96,16 +82,12 @@ RUN apk -U upgrade && \
/opt/java/openjdk/bin/keytool
-noprompt
-import
-trustcacerts
-alias
azure-cert
-file
/app/certs/DigiCertGlobalRootG2.crt.pem
-keystore
/etc/ssl/certs/java/cacerts
-keypass
changeit
-storepass
changeit
&&
\
mkdir
-p
/plugins
&&
chmod
a+rwx /plugins
# add fixed cacerts
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/
COPY
--from=builder /app/source/target/uberjar/metabase.jar /app/
COPY
bin/docker/run_metabase.sh /app/
# expose our default runtime port
EXPOSE
3000
# run it
ENTRYPOINT
["/app/
bin/start
"]
ENTRYPOINT
["/app/
run_metabase.sh
"]
\ No newline at end of file
This diff is collapsed.
Click to expand it.
bin/docker/Dockerfile
+
2
−
3
View file @
019322b2
...
...
@@ -3,8 +3,7 @@ FROM adoptopenjdk/openjdk11:alpine-jre
ENV
FC_LANG en-US LC_CTYPE en_US.UTF-8
# dependencies
RUN
apk
-U
upgrade
&&
\
apk add
--update
--no-cache
bash ttf-dejavu fontconfig curl java-cacerts
&&
\
RUN
apk upgrade & apk add
--update-cache
--no-cache
bash ttf-dejavu fontconfig curl java-cacerts
&&
\
mkdir
-p
/app/certs
&&
\
curl https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem
-o
/app/certs/rds-combined-ca-bundle.pem
&&
\
/opt/java/openjdk/bin/keytool
-noprompt
-import
-trustcacerts
-alias
aws-rds
-file
/app/certs/rds-combined-ca-bundle.pem
-keystore
/etc/ssl/certs/java/cacerts
-keypass
changeit
-storepass
changeit
&&
\
...
...
@@ -24,4 +23,4 @@ EXPOSE 3000
# $ docker run ... -v $PWD/metabase.db.mv.db:/app/initial.db.mv.db ...
# run it
ENTRYPOINT
["/app/run_metabase.sh"]
ENTRYPOINT
["/app/run_metabase.sh"]
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment