diff --git a/packages/nocodb/Dockerfile b/packages/nocodb/Dockerfile index 228352072c..1f1f271fe2 100644 --- a/packages/nocodb/Dockerfile +++ b/packages/nocodb/Dockerfile @@ -40,7 +40,7 @@ RUN echo "node-linker=hoisted" > .npmrc # install production dependencies, # reduce node_module size with modclean & removing sqlite deps, -# package built code into app.tar.gz & add execute permission to start.sh +# and add execute permission to start.sh RUN pnpm install --prod --shamefully-hoist \ && pnpm dlx modclean --patterns="default:*" --ignore="nc-lib-gui/**,dayjs/**,express-status-monitor/**,@azure/msal-node/dist/**" --run \ && rm -rf ./node_modules/sqlite3/deps \ @@ -63,7 +63,7 @@ RUN apk --update --no-cache add \ # Copy litestream binary build COPY --from=lt-builder /usr/src/lt /usr/src/appEntry/litestream -# Copy packaged production code & main entry file +# Copy production code & main entry file COPY --from=builder /usr/src/app/ /usr/src/app/ COPY --from=builder /usr/src/appEntry/ /usr/src/appEntry/ diff --git a/packages/nocodb/Dockerfile.local b/packages/nocodb/Dockerfile.local index 5a3687386b..72504ddfe5 100644 --- a/packages/nocodb/Dockerfile.local +++ b/packages/nocodb/Dockerfile.local @@ -23,7 +23,7 @@ RUN echo "node-linker=hoisted" > .npmrc # install production dependencies, # reduce node_module size with modclean & removing sqlite deps, -# package built code into app.tar.gz & add execute permission to start.sh +# and add execute permission to start.sh RUN pnpm uninstall nocodb-sdk RUN pnpm install --prod --shamefully-hoist --reporter=silent \ && pnpm dlx modclean --patterns="default:*" --ignore="nc-lib-gui/**,dayjs/**,express-status-monitor/**,@azure/msal-node/dist/**" --run \ @@ -47,7 +47,7 @@ RUN apk --update --no-cache add \ curl \ jq -# Copy packaged production code & main entry file +# Copy production code & main entry file COPY --from=builder /usr/src/app/ /usr/src/app/ COPY --from=builder /usr/src/appEntry/ /usr/src/appEntry/ diff --git a/packages/nocodb/docker/start-litestream.sh b/packages/nocodb/docker/start-litestream.sh index ccd9b98a54..7acb7a72c7 100644 --- a/packages/nocodb/docker/start-litestream.sh +++ b/packages/nocodb/docker/start-litestream.sh @@ -1,13 +1,12 @@ #!/bin/sh -FILE="/usr/src/app/package.json" #sleep 5 -if [ ! -z "${NC_TOOL_DIR}" ]; then - mkdir -p $NC_TOOL_DIR +if [ -n "${NC_TOOL_DIR}" ]; then + mkdir -p "$NC_TOOL_DIR" fi -if [[ ! -z "${AWS_ACCESS_KEY_ID}" && ! -z "${AWS_SECRET_ACCESS_KEY}" && ! -z "${AWS_BUCKET}" && ! -z "${AWS_BUCKET_PATH}" ]]; then +if [ -n "${AWS_ACCESS_KEY_ID}" ] && [ -n "${AWS_SECRET_ACCESS_KEY}" ] && [ -n "${AWS_BUCKET}" ] && [ -n "${AWS_BUCKET_PATH}" ]; then if [ -f "${NC_TOOL_DIR}noco.db" ] then @@ -16,17 +15,12 @@ if [[ ! -z "${AWS_ACCESS_KEY_ID}" && ! -z "${AWS_SECRET_ACCESS_KEY}" && ! -z "${ rm "${NC_TOOL_DIR}noco.db-wal" fi - /usr/src/appEntry/litestream restore -o "${NC_TOOL_DIR}noco.db" s3://$AWS_BUCKET/$AWS_BUCKET_PATH; + /usr/src/appEntry/litestream restore -o "${NC_TOOL_DIR}noco.db" "s3://$AWS_BUCKET/$AWS_BUCKET_PATH" if [ ! -f "${NC_TOOL_DIR}noco.db" ] then touch "${NC_TOOL_DIR}noco.db" fi - /usr/src/appEntry/litestream replicate "${NC_TOOL_DIR}noco.db" s3://$AWS_BUCKET/$AWS_BUCKET_PATH & -fi - -if [ ! -f "$FILE" ] -then - tar -xzf /usr/src/appEntry/app.tar.gz -C /usr/src/app/ + /usr/src/appEntry/litestream replicate "${NC_TOOL_DIR}noco.db" "s3://$AWS_BUCKET/$AWS_BUCKET_PATH" & fi node docker/main.js diff --git a/packages/nocodb/docker/start-local.sh b/packages/nocodb/docker/start-local.sh index 619e2f58fd..3dd17d0d04 100644 --- a/packages/nocodb/docker/start-local.sh +++ b/packages/nocodb/docker/start-local.sh @@ -1,14 +1,7 @@ #!/bin/sh -FILE="/usr/src/app/package.json" - -if [ ! -z "${NC_TOOL_DIR}" ]; then - mkdir -p $NC_TOOL_DIR -fi - -if [ ! -f "$FILE" ] -then - tar -xzf /usr/src/appEntry/app.tar.gz -C /usr/src/app/ +if [ -n "${NC_TOOL_DIR}" ]; then + mkdir -p "$NC_TOOL_DIR" fi node docker/index.js diff --git a/packages/nocodb/docker/start.sh b/packages/nocodb/docker/start.sh index 0f96b9454a..85e38fe290 100644 --- a/packages/nocodb/docker/start.sh +++ b/packages/nocodb/docker/start.sh @@ -1,10 +1,3 @@ #!/bin/sh -FILE="/usr/src/app/package.json" - -if [ ! -f "$FILE" ] -then - tar -xzf /usr/src/appEntry/app.tar.gz -C /usr/src/app/ -fi - -node docker/main.js \ No newline at end of file +node docker/main.js diff --git a/packages/nocodb/litestream/Dockerfile b/packages/nocodb/litestream/Dockerfile index f4a781ecde..23b9200e3f 100644 --- a/packages/nocodb/litestream/Dockerfile +++ b/packages/nocodb/litestream/Dockerfile @@ -30,11 +30,10 @@ RUN echo "node-linker=hoisted" > .npmrc # install production dependencies, # reduce node_module size with modclean & removing sqlite deps, -# package built code into app.tar.gz & add execute permission to start.sh +# and add execute permission to start.sh RUN pnpm install --prod --shamefully-hoist --reporter=silent RUN pnpm dlx modclean --patterns="default:*" --ignore="nc-lib-gui/**,dayjs/**,express-status-monitor/**" --run RUN rm -rf ./node_modules/sqlite3/deps -RUN tar -czf ../appEntry/app.tar.gz ./* RUN chmod +x /usr/src/appEntry/start.sh FROM alpine:3.19 @@ -87,7 +86,8 @@ RUN apk --update --no-cache add \ # Copy litestream binary build COPY --from=lt /usr/src/lt /usr/src/appEntry/litestream -# Copy packaged production code & main entry file +# Copy production code & main entry file +COPY --from=builder /usr/src/app/ /usr/src/app/ COPY --from=builder /usr/src/appEntry/ /usr/src/appEntry/