Skip to content

Commit bb0a0e7

Browse files
committed
feat(docker): Remove gcc/g++/cmake/python from final images
1 parent 6ee4218 commit bb0a0e7

File tree

7 files changed

+98
-68
lines changed

7 files changed

+98
-68
lines changed

DEPRECATION.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,22 @@ features:
3434
should not rely on this feature.
3535

3636
| Status | Feature | Deprecated | Remove |
37-
| ---------- |-----------------------------------------------------------------------------------------------------------------------------------|------------|-----------|
37+
|------------|-----------------------------------------------------------------------------------------------------------------------------------|------------|-----------|
3838
| Removed | [Node.js 8](#nodejs-8) | v0.22.4 | v0.26.0 |
3939
| Deprecated | [`hearBeatInterval`](#hearbeatinterval) | v0.23.8 | June 2021 |
4040
| Removed | [`CUBEJS_ENABLE_TLS`](#cubejs_enable_tls) | v0.23.11 | v0.26.0 |
4141
| Deprecated | [Embedding Cube.js within Express](#embedding-cubejs-within-express) | v0.24.0 | June 2021 |
42-
| Deprecated | [Absolute import for `@cubejs-backend/query-orchestrator`](#absolute-import-for-@cubejs-backendquery-orchestrator) | v0.24.2 | v0.32.0 |
42+
| Removed | [Absolute import for `@cubejs-backend/query-orchestrator`](#absolute-import-for-@cubejs-backendquery-orchestrator) | v0.24.2 | v0.32.0 |
4343
| Removed | [`contextToDataSourceId`](#contexttodatasourceid) | v0.25.0 | v0.25.0 |
44-
| Deprecated | [Absolute import for `@cubejs-backend/server-core`](#absolute-import-for-@cubejs-backendserver-core) | v0.25.4 | v0.32.0 |
45-
| Deprecated | [Absolute import for `@cubejs-backend/schema-compiler`](#absolute-import-for-@cubejs-backendschema-compiler) | v0.25.21 | v0.32.0 |
44+
| Removed | [Absolute import for `@cubejs-backend/server-core`](#absolute-import-for-@cubejs-backendserver-core) | v0.25.4 | v0.32.0 |
45+
| Removed | [Absolute import for `@cubejs-backend/schema-compiler`](#absolute-import-for-@cubejs-backendschema-compiler) | v0.25.21 | v0.32.0 |
4646
| Deprecated | [`checkAuthMiddleware`](#checkauthmiddleware) | v0.26.0 | |
4747
| Removed | [Node.js 10](#nodejs-10) | v0.26.0 | v0.29.0 |
4848
| Removed | [Node.js 15](#nodejs-15) | v0.26.0 | v0.32.0 |
4949
| Deprecated | [`USER_CONTEXT`](#user_context) | v0.26.0 | |
5050
| Deprecated | [`authInfo`](#authinfo) | v0.26.0 | |
5151
| Deprecated | [Prefix Redis environment variables with `CUBEJS_`](#prefix-redis-environment-variables-with-cubejs_) | v0.27.0 | |
52-
| Deprecated | [Node.js 12](#nodejs-12) | v0.29.0 | v0.32.0 |
52+
| Removed | [Node.js 12](#nodejs-12) | v0.29.0 | v0.32.0 |
5353
| Deprecated | [`CUBEJS_EXTERNAL_DEFAULT` and `CUBEJS_SCHEDULED_REFRESH_DEFAULT`](#cubejs_external_default-and-cubejs_scheduled_refresh_default) | v0.30.0 | |
5454
| Deprecated | [Using external databases for pre-aggregations](#using-external-databases-for-pre-aggregations) | v0.30.0 | |
5555
| Deprecated | [`dbType`](#dbtype) | v0.30.30 | |

packages/cubejs-docker/dev.Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ ENV CI=0
99
RUN DEBIAN_FRONTEND=noninteractive \
1010
&& apt-get update \
1111
&& apt-get install -y --no-install-recommends rxvt-unicode libssl1.1 curl \
12-
cmake python2 python3 gcc g++ make cmake openjdk-11-jdk-headless \
13-
&& npm config set python /usr/bin/python2.7 \
12+
cmake python3 gcc g++ make cmake openjdk-11-jdk-headless \
1413
&& rm -rf /var/lib/apt/lists/*
1514

1615
ENV RUSTUP_HOME=/usr/local/rustup

packages/cubejs-docker/latest-alpine-jdk.Dockerfile

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,35 @@
1+
FROM node:16.19.1-alpine3.17 as builder
2+
3+
WORKDIR /cube
4+
COPY . .
5+
6+
RUN yarn policies set-version v1.22.5
7+
8+
# Required for node-oracledb to buld on ARM64
9+
RUN apk update \
10+
&& apk add python3 gcc g++ make openjdk11-jdk \
11+
&& rm -rf /var/cache/apk/*
12+
13+
ENV JAVA_HOME /usr/lib/jvm/default-jvm
14+
ENV PATH "$JAVA_HOME/bin:${PATH}"
15+
16+
# We are copying root yarn.lock file to the context folder during the Publish GH
17+
# action. So, a process will use the root lock file here.
18+
RUN yarn install && yarn cache clean
19+
120
FROM node:16.19.1-alpine3.17
221

322
ARG IMAGE_VERSION=unknown
423

524
ENV CUBEJS_DOCKER_IMAGE_VERSION=$IMAGE_VERSION
625
ENV CUBEJS_DOCKER_IMAGE_TAG=alpine
726

8-
RUN apk add rxvt-unicode
27+
RUN apk update \
28+
&& apk add openjdk11-jdk rxvt-unicode \
29+
&& rm -rf /var/cache/apk/*
30+
31+
ENV JAVA_HOME /usr/lib/jvm/default-jvm
32+
ENV PATH "$JAVA_HOME/bin:${PATH}"
933

1034
ENV TERM rxvt-unicode
1135
ENV NODE_ENV production
@@ -15,19 +39,9 @@ COPY . .
1539

1640
RUN yarn policies set-version v1.22.5
1741

18-
# Required for node-oracledb to buld on ARM64
19-
RUN apk update \
20-
&& apk add python2 gcc g++ make cmake bash openjdk11-jdk \
21-
&& npm config set python /usr/bin/python2.7 \
22-
&& rm -rf /var/cache/apk/*
23-
24-
ENV JAVA_HOME /usr/lib/jvm/default-jvm
25-
ENV PATH "$JAVA_HOME/bin:${PATH}"
42+
WORKDIR /cube
2643

27-
# There is a problem with release process.
28-
# We are doing version bump without updating lock files for the docker package.
29-
#RUN yarn install --frozen-lockfile
30-
RUN yarn install && yarn cache clean
44+
COPY --from=builder /cube .
3145

3246
# By default Node dont search in parent directory from /cube/conf, @todo Reaserch a little bit more
3347
ENV NODE_PATH /cube/conf/node_modules:/cube/node_modules

packages/cubejs-docker/latest-alpine.Dockerfile

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
FROM node:16.19.1-alpine3.17 as builder
2+
3+
WORKDIR /cube
4+
COPY . .
5+
6+
RUN yarn policies set-version v1.22.5
7+
8+
# Required for node-oracledb to buld on ARM64
9+
RUN apk update \
10+
&& apk add python3 gcc g++ make \
11+
&& rm -rf /var/cache/apk/*
12+
13+
# We are copying root yarn.lock file to the context folder during the Publish GH
14+
# action. So, a process will use the root lock file here.
15+
RUN yarn install && yarn cache clean
16+
117
FROM node:16.19.1-alpine3.17
218

319
ARG IMAGE_VERSION=unknown
@@ -11,19 +27,8 @@ ENV TERM rxvt-unicode
1127
ENV NODE_ENV production
1228

1329
WORKDIR /cube
14-
COPY . .
15-
16-
RUN yarn policies set-version v1.22.5
17-
18-
# Required for node-oracledb to buld on ARM64
19-
RUN apk update \
20-
&& apk add python2 gcc g++ make \
21-
&& npm config set python /usr/bin/python2.7 \
22-
&& rm -rf /var/cache/apk/*
2330

24-
# We are copying root yarn.lock file to the context folder during the Publish GH
25-
# action. So, a process will use the root lock file here.
26-
RUN yarn install && yarn cache clean
31+
COPY --from=builder /cube .
2732

2833
# By default Node dont search in parent directory from /cube/conf, @todo Reaserch a little bit more
2934
ENV NODE_PATH /cube/conf/node_modules:/cube/node_modules
Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,52 @@
11
# syntax=docker/dockerfile-upstream:master-experimental
2+
FROM node:16.19.1-bullseye-slim as builder
3+
4+
WORKDIR /cube
5+
COPY . .
6+
7+
RUN yarn policies set-version v1.22.5
8+
9+
# Required for node-oracledb to buld on ARM64
10+
RUN apt-get update \
11+
&& apt-get install -y python3 gcc g++ make cmake openjdk-11-jdk-headless \
12+
&& rm -rf /var/lib/apt/lists/*
13+
14+
# We are copying root yarn.lock file to the context folder during the Publish GH
15+
# action. So, a process will use the root lock file here.
16+
RUN yarn install && yarn cache clean
17+
218
FROM node:16.19.1-bullseye-slim
319

420
ARG IMAGE_VERSION=unknown
521

622
ENV CUBEJS_DOCKER_IMAGE_VERSION=$IMAGE_VERSION
723
ENV CUBEJS_DOCKER_IMAGE_TAG=latest
824

9-
RUN DEBIAN_FRONTEND=noninteractive \
25+
RUN groupadd cube && useradd -ms /bin/bash -g cube cube \
26+
&& DEBIAN_FRONTEND=noninteractive \
1027
&& apt-get update \
11-
&& apt-get install -y --no-install-recommends rxvt-unicode libssl1.1 \
12-
&& rm -rf /var/lib/apt/lists/*
13-
14-
ENV TERM rxvt-unicode
15-
ENV NODE_ENV production
16-
17-
# Required for node-oracledb to buld on ARM64
18-
RUN groupadd cube \
19-
&& useradd -ms /bin/bash -g cube cube \
20-
&& apt-get clean \
21-
&& apt-get update \
22-
&& apt-get install -y python2 python3 gcc g++ make cmake openjdk-11-jdk-headless \
23-
&& npm config set python /usr/bin/python2.7 \
28+
&& apt-get install -y --no-install-recommends rxvt-unicode libssl1.1 openjdk-11-jdk-headless \
2429
&& rm -rf /var/lib/apt/lists/* \
2530
&& mkdir cube \
2631
&& chown -R cube:cube /tmp /cube /usr
2732

2833
USER cube
2934
WORKDIR /cube
30-
COPY --chown=cube:cube . .
3135

32-
# We are copying root yarn.lock file to the context folder during the Publish GH
33-
# action. So, a process will use the root lock file here.
34-
RUN yarn policies set-version v1.22.5 \
35-
&& yarn install && yarn cache clean
36+
RUN yarn policies set-version v1.22.5
37+
38+
ENV TERM rxvt-unicode
39+
ENV NODE_ENV production
40+
41+
COPY --chown=cube:cube --from=builder /cube .
3642

3743
# By default Node dont search in parent directory from /cube/conf, @todo Reaserch a little bit more
3844
ENV NODE_PATH /cube/conf/node_modules:/cube/node_modules
39-
RUN ln -s /cube/node_modules/.bin/cubejs /usr/local/bin/cubejs \
40-
&& ln -s /cube/node_modules/.bin/cubestore-dev /usr/local/bin/cubestore-dev
45+
RUN ln -s /cube/node_modules/.bin/cubejs /usr/local/bin/cubejs
46+
RUN ln -s /cube/node_modules/.bin/cubestore-dev /usr/local/bin/cubestore-dev
4147

4248
WORKDIR /cube/conf
4349

4450
EXPOSE 4000
4551

46-
CMD ["cubejs", "server"]
52+
CMD ["cubejs", "server"]

packages/cubejs-docker/latest.Dockerfile

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
FROM node:16.19.1-bullseye-slim as builder
2+
3+
WORKDIR /cube
4+
COPY . .
5+
6+
RUN yarn policies set-version v1.22.5
7+
8+
# Required for node-oracledb to buld on ARM64
9+
RUN apt-get update \
10+
&& apt-get install -y python3 gcc g++ make cmake \
11+
&& rm -rf /var/lib/apt/lists/*
12+
13+
# We are copying root yarn.lock file to the context folder during the Publish GH
14+
# action. So, a process will use the root lock file here.
15+
RUN yarn install && yarn cache clean
16+
117
FROM node:16.19.1-bullseye-slim
218

319
ARG IMAGE_VERSION=unknown
@@ -10,23 +26,14 @@ RUN DEBIAN_FRONTEND=noninteractive \
1026
&& apt-get install -y --no-install-recommends rxvt-unicode libssl1.1 \
1127
&& rm -rf /var/lib/apt/lists/*
1228

29+
RUN yarn policies set-version v1.22.5
30+
1331
ENV TERM rxvt-unicode
1432
ENV NODE_ENV production
1533

1634
WORKDIR /cube
17-
COPY . .
1835

19-
RUN yarn policies set-version v1.22.5
20-
21-
# Required for node-oracledb to buld on ARM64
22-
RUN apt-get update \
23-
&& apt-get install -y python2 python3 gcc g++ make cmake \
24-
&& npm config set python /usr/bin/python2.7 \
25-
&& rm -rf /var/lib/apt/lists/*
26-
27-
# We are copying root yarn.lock file to the context folder during the Publish GH
28-
# action. So, a process will use the root lock file here.
29-
RUN yarn install && yarn cache clean
36+
COPY --from=builder /cube .
3037

3138
# By default Node dont search in parent directory from /cube/conf, @todo Reaserch a little bit more
3239
ENV NODE_PATH /cube/conf/node_modules:/cube/node_modules

packages/cubejs-docker/local.Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ RUN yarn policies set-version v1.22.5
2828

2929
# Required for node-oracledb to buld on ARM64
3030
RUN apt-get update \
31-
&& apt-get install -y python2 python3 gcc g++ make cmake \
32-
&& npm config set python /usr/bin/python2.7 \
31+
&& apt-get install -y python3 gcc g++ make cmake \
3332
&& rm -rf /var/lib/apt/lists/*
3433

3534
# We are copying root yarn.lock file to the context folder during the Publish GH

0 commit comments

Comments
 (0)