From ff149552182c7aa1f590d8cc9f293fab151baef6 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Sat, 12 Oct 2024 13:43:21 +0530 Subject: [PATCH] chore: cleanup and add sharp Signed-off-by: Pranav C --- packages/nocodb/Dockerfile.timely | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/nocodb/Dockerfile.timely b/packages/nocodb/Dockerfile.timely index 441c7bc322..b5335cac3c 100644 --- a/packages/nocodb/Dockerfile.timely +++ b/packages/nocodb/Dockerfile.timely @@ -11,9 +11,10 @@ WORKDIR /usr/src/ # Use build platform-specific tools RUN apk --no-cache add git make musl-dev gcc -# Build litestream for target platform +# Build litestream for the target platform RUN git clone https://github.com/benbjohnson/litestream.git litestream \ - && cd litestream && GOARCH=$(go env GOARCH) GOOS=$(go env GOOS) go install ./cmd/litestream \ + && cd litestream \ + && GOARCH=$(echo $TARGETPLATFORM | cut -d '/' -f 2) GOOS=$(echo $TARGETPLATFORM | cut -d '/' -f 1) go install ./cmd/litestream \ && cp $GOPATH/bin/litestream /usr/src/lt ########### @@ -45,18 +46,15 @@ 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 \ && chmod +x /usr/src/appEntry/start.sh -# && (pnpm exec prebuild-install -- --platform=$TARGETPLATFORM --arch=$TARGETARCH -r napi || echo "Prebuilt binary not available") \ -# && npm install sqlite3 --target_arch=$BUILDARCH --target_platform=$BUILDOS --legacy-peer-deps \ - ############ -## Sqlite3 Builder +## Binary Dependencies Builder ############ -FROM node:18.19.1-alpine as sqlite-builder +FROM --platform=$TARGETPLATFORM node:18.19.1-alpine as bin-builder WORKDIR /usr/src/app # Install sqlite3 for the target platform to copy to the final image -RUN npm init -y && npm install sqlite3 +RUN npm init -y && npm install sqlite3 sharp ########### # Runner @@ -82,7 +80,8 @@ COPY --link ./docker/litestream.yml /etc/litestream.yml # Copy production code & main entry file COPY --link --from=builder /usr/src/app/ /usr/src/app/ -COPY --link --from=sqlite-builder /usr/src/app/node_modules/sqlite3/ /usr/src/app/node_modules/sqlite3/ +COPY --link --from=bin-builder /usr/src/app/node_modules/sqlite3/ /usr/src/app/node_modules/sqlite3/ +COPY --link --from=bin-builder /usr/src/app/node_modules/sharp/ /usr/src/app/node_modules/sharp/ COPY --link --from=builder /usr/src/appEntry/ /usr/src/appEntry/ EXPOSE 8080