forked from cube-js/cube
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathincognia.Dockerfile
75 lines (58 loc) · 3.14 KB
/
incognia.Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
FROM node:18.20.1-bullseye-slim AS base
WORKDIR /cube
COPY package.json .
COPY lerna.json .
COPY yarn.lock .
COPY tsconfig.base.json .
ENV CUBESTORE_SKIP_POST_INSTALL=true
COPY packages/cubejs-backend-shared/package.json packages/cubejs-backend-shared/package.json
COPY packages/cubejs-base-driver/package.json packages/cubejs-base-driver/package.json
COPY packages/cubejs-backend-native/package.json packages/cubejs-backend-native/package.json
COPY packages/cubejs-api-gateway/package.json packages/cubejs-api-gateway/package.json
COPY packages/cubejs-cli/package.json packages/cubejs-cli/package.json
COPY packages/cubejs-cubestore-driver/package.json packages/cubejs-cubestore-driver/package.json
COPY packages/cubejs-prestodb-driver/package.json packages/cubejs-prestodb-driver/package.json
COPY packages/cubejs-trino-driver/package.json packages/cubejs-trino-driver/package.json
COPY packages/cubejs-query-orchestrator/package.json packages/cubejs-query-orchestrator/package.json
COPY packages/cubejs-schema-compiler/package.json packages/cubejs-schema-compiler/package.json
COPY packages/cubejs-server/package.json packages/cubejs-server/package.json
COPY packages/cubejs-server-core/package.json packages/cubejs-server-core/package.json
FROM base AS prod_deps
# Use yarn v2+ because of https://github.com/yarnpkg/yarn/issues/6323
# The yarn versions prior to 1.22.20 have a bug that it always download
# the latest release, so first we manually go to the 4.1.1 before going
# to the target version.
RUN YARN_IGNORE_NODE=1 yarn set version 4.1.1
RUN YARN_IGNORE_NODE=1 yarn set version 3.8.1
RUN yarn plugin import workspace-tools
RUN yarn config set nodeLinker node-modules
RUN yarn workspaces focus --production --all
FROM base AS builder
COPY packages/cubejs-backend-shared/ packages/cubejs-backend-shared/
COPY packages/cubejs-base-driver/ packages/cubejs-base-driver/
COPY packages/cubejs-backend-native/ packages/cubejs-backend-native/
COPY packages/cubejs-api-gateway/ packages/cubejs-api-gateway/
COPY packages/cubejs-cli/ packages/cubejs-cli/
COPY packages/cubejs-cubestore-driver/ packages/cubejs-cubestore-driver/
COPY packages/cubejs-prestodb-driver/ packages/cubejs-prestodb-driver/
COPY packages/cubejs-trino-driver/ packages/cubejs-trino-driver/
COPY packages/cubejs-query-orchestrator/ packages/cubejs-query-orchestrator/
COPY packages/cubejs-schema-compiler/ packages/cubejs-schema-compiler/
COPY packages/cubejs-server/ packages/cubejs-server/
COPY packages/cubejs-server-core/ packages/cubejs-server-core/
RUN yarn install
RUN yarn lerna run build
RUN find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +
FROM base AS final
ARG IMAGE_VERSION=unknown
COPY --from=builder /cube .
COPY --from=prod_deps /cube .
ENV CUBEJS_DOCKER_IMAGE_TAG=latest
ENV CUBEJS_DOCKER_IMAGE_VERSION=$IMAGE_VERSION
ENV NODE_ENV production
ENV NODE_PATH /cube/conf/node_modules:/cube/node_modules
# I'm not sure why yarn is not automatically creating this bin file, but we just do it manually here
RUN chmod +x /cube/packages/cubejs-cli/dist/src/index.js && ln -s /cube/packages/cubejs-cli/dist/src/index.js /usr/local/bin/cubejs
WORKDIR /cube/conf
EXPOSE 4000
CMD ["cubejs", "server"]