Browse Source

fix(nocodb): pnpm

pull/5903/head
Wing-Kam Wong 1 year ago
parent
commit
c7b81177f9
  1. 9
      packages/nocodb/Dockerfile
  2. 11
      packages/nocodb/Dockerfile.local

9
packages/nocodb/Dockerfile

@ -18,15 +18,18 @@ RUN cp $GOPATH/bin/litestream /usr/src/lt
########### ###########
# Builder # Builder
########### ###########
FROM node:16.17.0-alpine3.15 as builder FROM node:18.12.1-alpine as builder
WORKDIR /usr/src/app WORKDIR /usr/src/app
# install pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
# install node-gyp dependencies # install node-gyp dependencies
RUN apk add --no-cache python3 make g++ RUN apk add --no-cache python3 make g++
# Copy application dependency manifests to the container image. # Copy application dependency manifests to the container image.
# A wildcard is used to ensure both package.json AND package-lock.json are copied. # A wildcard is used to ensure both package.json AND package-lock.json are copied.
# Copying this separately prevents re-running npm install on every code change. # Copying this separately prevents re-running pnpm install on every code change.
COPY ./package*.json ./ COPY ./package*.json ./
COPY ./docker/main.js ./docker/main.js COPY ./docker/main.js ./docker/main.js
#COPY ./docker/start.sh /usr/src/appEntry/start.sh #COPY ./docker/start.sh /usr/src/appEntry/start.sh
@ -36,7 +39,7 @@ COPY src/public/ ./docker/public/
# install production dependencies, # install production dependencies,
# reduce node_module size with modclean & removing sqlite deps, # reduce node_module size with modclean & removing sqlite deps,
# package built code into app.tar.gz & add execute permission to start.sh # package built code into app.tar.gz & add execute permission to start.sh
RUN npm install --omit=dev --quiet \ RUN pnpm install --omit=dev --quiet \
&& npx modclean --patterns="default:*" --ignore="nc-lib-gui/**,dayjs/**,express-status-monitor/**,@azure/msal-node/dist/**" --run \ && npx modclean --patterns="default:*" --ignore="nc-lib-gui/**,dayjs/**,express-status-monitor/**,@azure/msal-node/dist/**" --run \
&& rm -rf ./node_modules/sqlite3/deps \ && rm -rf ./node_modules/sqlite3/deps \
&& tar -czf ../appEntry/app.tar.gz ./* \ && tar -czf ../appEntry/app.tar.gz ./* \

11
packages/nocodb/Dockerfile.local

@ -1,15 +1,18 @@
########### ###########
# Builder # Builder
########### ###########
FROM node:16.17.0-alpine3.15 as builder FROM node:18.12.1-alpine as builder
WORKDIR /usr/src/app WORKDIR /usr/src/app
# install node-gyp dependencies # install node-gyp dependencies
RUN apk add --no-cache python3 make g++ RUN apk add --no-cache python3 make g++
# install pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
# Copy application dependency manifests to the container image. # Copy application dependency manifests to the container image.
# A wildcard is used to ensure both package.json AND package-lock.json are copied. # A wildcard is used to ensure both package.json AND package-lock.json are copied.
# Copying this separately prevents re-running npm install on every code change. # Copying this separately prevents re-running pnpm install on every code change.
COPY ./package*.json ./ COPY ./package*.json ./
COPY ./docker/nc-gui/ ./docker/nc-gui/ COPY ./docker/nc-gui/ ./docker/nc-gui/
COPY ./docker/main.js ./docker/index.js COPY ./docker/main.js ./docker/index.js
@ -19,8 +22,8 @@ COPY src/public/ ./docker/public/
# install production dependencies, # install production dependencies,
# reduce node_module size with modclean & removing sqlite deps, # reduce node_module size with modclean & removing sqlite deps,
# package built code into app.tar.gz & add execute permission to start.sh # package built code into app.tar.gz & add execute permission to start.sh
RUN npm uninstall --save nocodb-sdk RUN pnpm uninstall --save nocodb-sdk
RUN npm install --omit=dev --quiet \ RUN pnpm install --omit=dev --quiet \
&& npx modclean --patterns="default:*" --ignore="nc-lib-gui/**,dayjs/**,express-status-monitor/**,@azure/msal-node/dist/**" --run \ && npx modclean --patterns="default:*" --ignore="nc-lib-gui/**,dayjs/**,express-status-monitor/**,@azure/msal-node/dist/**" --run \
&& rm -rf ./node_modules/sqlite3/deps \ && rm -rf ./node_modules/sqlite3/deps \
&& tar -czf ../appEntry/app.tar.gz ./* \ && tar -czf ../appEntry/app.tar.gz ./* \

Loading…
Cancel
Save