cube.js 官方docker镜像发布
最近的cube.js 官方发布了docker 镜像,基于alpine,而且官方也比较推荐使用docker 运行,这样
可以进行服务的隔离
参考使用
- .env
主要是进行db配置的,具体结合自己的实际配置,参数说明,参考官方文档 - cube.js
// Cube.js configuration options: https://cube.dev/docs/config
module.exports = {
// Cube.js options go here, none by default
// Options set via environment variables take precedence
};
- docker-compose 文件
version: "3"
services:
cube:
image: cubejs/cube:latest
ports:
- 4000:4000 # Cube.js API
- 3000:3000 # Developer Playground
env_file: .env
volumes:
- ./dashboard-app:/cube/conf/dashboard-app
- ./cube.js:/cube/conf/cube.js
- ./schema:/cube/conf/schema
参考dockerfile文件
FROM node:12.19-alpine
ENV CUBEJS_DOCKER_IMAGE_TAG=alpine
RUN apk add rxvt-unicode
ENV TERM rxvt-unicode
ENV NODE_ENV production
WORKDIR /cube
COPY . .
# There is a problem with release process.
# We are doing version bump without updating lock files for the docker package.
#RUN yarn install --frozen-lockfile
RUN yarn install
# By default Node dont search in parent directory from /cube/conf, @todo Reaserch a little bit more
ENV NODE_PATH /cube/conf/node_modules:/cube/node_modules
RUN ln -s /cube/node_modules/.bin/cubejs /usr/local/bin/cubejs
VOLUME /cube/conf
WORKDIR /cube/conf
EXPOSE 4000
CMD ["cubejs", "server"]
docker 镜像简单说明
/cube 系统目录,存放了预安装的db 驱动
/cube/conf cube.js 以及schema 的配置目录
说明
官方也提供了cli 命令,我们可以直接用来创建基于docker 部署的西三姑
参考命令
npx cubejs-cli create cubejs-docker-demo -t docker -d postgres
参考资料
https://github.com/cube-js/cube.js/projects/6#card-48286488
https://github.com/cube-js/cube.js/blob/master/CHANGELOG.md
https://cube.dev/blog/cubejs-loves-docker/
https://cube.dev/docs/deployment/guide/
https://cube.dev/docs/configuration/overview#migration-from-express-to-docker-template
https://github.com/cube-js/cube.js/tree/master/packages/cubejs-docker