Skip to content

Commit 71aadb1

Browse files
committed
Update docker image build process
1 parent ebaec95 commit 71aadb1

File tree

3 files changed

+80
-1
lines changed

3 files changed

+80
-1
lines changed

.dockerignore

+5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
!rust/cubestore/package.json
1111
!rust/cubestore/bin
1212
!rust/cubesql/package.json
13+
!rust/cubenativeutils
14+
!rust/cubeorchestrator
15+
!rust/cubeshared
16+
!rust/cubesql
17+
!rust/cubesqlplanner
1318

1419
# Ignoring builds for native from local machime to protect a problem with different architecture
1520
packages/cubejs-backend-native/index.node

cloudbuild.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ steps:
1212
entrypoint: bash
1313
args:
1414
- -c
15-
- 'docker buildx build -t us-docker.pkg.dev/definite-371419/cube/cube:${_TAG} -f packages/cubejs-docker/dev.Dockerfile . --push'
15+
- 'docker buildx build -t us-docker.pkg.dev/definite-371419/cube/cube:${_TAG} -f packages/cubejs-docker/definite.Dockerfile . --push'
1616
id: Build
1717

1818

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
FROM node:20.17.0-bookworm-slim AS base
2+
3+
ARG IMAGE_VERSION=dev
4+
5+
ENV CUBEJS_DOCKER_IMAGE_VERSION=$IMAGE_VERSION
6+
ENV CUBEJS_DOCKER_IMAGE_TAG=dev
7+
ENV CI=0
8+
9+
RUN DEBIAN_FRONTEND=noninteractive \
10+
&& apt-get update \
11+
# python3 package is necessary to install `python3` executable for node-gyp
12+
&& apt-get install -y --no-install-recommends libssl3 curl \
13+
cmake python3 python3.11 libpython3.11-dev gcc g++ make cmake openjdk-17-jdk-headless \
14+
&& rm -rf /var/lib/apt/lists/*
15+
16+
ENV RUSTUP_HOME=/usr/local/rustup
17+
ENV CARGO_HOME=/usr/local/cargo
18+
ENV PATH=/usr/local/cargo/bin:$PATH
19+
20+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
21+
sh -s -- --profile minimal --default-toolchain nightly-2022-03-08 -y
22+
23+
ENV CUBESTORE_SKIP_POST_INSTALL=true
24+
ENV NODE_ENV=development
25+
26+
WORKDIR /cubejs
27+
28+
COPY package.json .
29+
COPY lerna.json .
30+
COPY yarn.lock .
31+
COPY tsconfig.base.json .
32+
COPY rollup.config.js .
33+
34+
RUN yarn policies set-version v1.22.22
35+
# Yarn v1 uses aggressive timeouts with summing time spending on fs, https://github.com/yarnpkg/yarn/issues/4890
36+
RUN yarn config set network-timeout 120000 -g
37+
38+
# Backend
39+
COPY rust/ rust/
40+
41+
COPY packages/ packages/
42+
43+
RUN rm -rf packages/cubejs-testing/ packages/cubejs-docker/
44+
45+
RUN yarn install
46+
RUN yarn build
47+
RUN yarn lerna run build
48+
49+
RUN cd packages/cubejs-backend-native && yarn run native:build-release
50+
51+
RUN find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +
52+
53+
FROM base AS final
54+
55+
ENV DEBIAN_FRONTEND=noninteractive
56+
RUN apt-get update \
57+
&& apt-get install -y ca-certificates python3.11 libpython3.11-dev \
58+
&& apt-get clean
59+
60+
COPY --from=base /cubejs .
61+
62+
COPY packages/cubejs-docker/bin/cubejs-dev /usr/local/bin/cubejs
63+
64+
# By default Node dont search in parent directory from /cube/conf, @todo Reaserch a little bit more
65+
ENV NODE_PATH /cube/conf/node_modules:/cube/node_modules
66+
ENV PYTHONUNBUFFERED=1
67+
RUN ln -s /cubejs/packages/cubejs-docker /cube
68+
RUN ln -s /cubejs/rust/cubestore/bin/cubestore-dev /usr/local/bin/cubestore-dev
69+
70+
WORKDIR /cube/conf
71+
72+
EXPOSE 4000
73+
74+
CMD ["cubejs", "server"]

0 commit comments

Comments
 (0)