Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix: update Docker images?

DarkPhoenix27040d094ba6ca03
diff --git a/packages/nocodb/Dockerfile b/packages/nocodb/Dockerfile
index 8165776b16..10681df791 100644
--- a/packages/nocodb/Dockerfile
+++ b/packages/nocodb/Dockerfile
@@ -68,16 +68,30 @@ ENV LITESTREAM_S3_SKIP_VERIFY=false \
NC_DOCKER=0.6 \
NC_TOOL_DIR=/usr/app/data/ \
NODE_ENV=production \
- PORT=8080
-
-# Install additional runtime dependencies
-RUN apt-get update && apt-get install -y \
- dumb-init \
- curl \
- wget \
- && curl -L "https://github.com/TomWright/dasel/releases/download/v2.8.1/dasel_linux_$(dpkg --print-architecture)" -o /usr/local/bin/dasel \
- && chmod +x /usr/local/bin/dasel \
- && apt-get clean && rm -rf /var/lib/apt/lists/*
+ PORT=8080 \
+ HOME=/tmp
+
+# Create non-root user
+RUN groupadd -g 1001 nocodb && \
+ useradd -r -u 1001 -g nocodb nocodb
+
+# Install runtime dependencies
+RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y --no-install-recommends \
+ ca-certificates `# required by wget for HTTPS support` \
+ curl \
+ dumb-init \
+ fontconfig \
+ fonts-dejavu-core \
+ fonts-liberation \
+ libreoffice \
+ wget `# for convenience of downstream users` \
+ && curl -L "https://github.com/TomWright/dasel/releases/download/v2.8.1/dasel_linux_$(dpkg --print-architecture)" -o /usr/local/bin/dasel \
+ && chmod +x /usr/local/bin/dasel \
+ && fc-cache -f -v \
+ && apt-get clean && rm -rf /var/lib/apt/lists/*
+
+# Set proper permissions
+RUN chown -R nocodb:nocodb /usr/src/app
# Copy litestream binary and config file
COPY --link --from=lt-builder /usr/src/lt /usr/local/bin/litestream
@@ -87,9 +101,11 @@ COPY --link ./docker/litestream.yml /etc/litestream.yml
COPY --link --from=builder /usr/src/app/ /usr/src/app/
COPY --link --from=builder /usr/src/appEntry/ /usr/src/appEntry/
+# Switch to non-root user
+USER nocodb
+
EXPOSE 8080
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
-# Start Nocodb
-CMD ["/usr/src/appEntry/start.sh"]
-
+# Start NocoDB
+CMD ["/usr/src/appEntry/start.sh"]
\ No newline at end of file
diff --git a/packages/nocodb/Dockerfile.local b/packages/nocodb/Dockerfile.local
index 40d3828940..2f8b956527 100644
--- a/packages/nocodb/Dockerfile.local
+++ b/packages/nocodb/Dockerfile.local
@@ -41,22 +41,38 @@ FROM alpine:3.20
WORKDIR /usr/src/app
ENV NC_DOCKER=0.6 \
- NC_TOOL_DIR=/usr/app/data/ \
- NODE_ENV=production \
- PORT=8080
+ NC_TOOL_DIR=/usr/app/data/ \
+ NODE_ENV=production \
+ PORT=8080 \
+ HOME=/tmp
+
+# Create non-root user
+RUN addgroup -g 1001 -S nocodb && \
+ adduser -S nocodb -u 1001 -G nocodb
RUN apk add --update --no-cache \
- curl \
- dumb-init \
- jq \
- nodejs
+ curl \
+ dumb-init \
+ fontconfig \
+ jq \
+ libreoffice \
+ nodejs \
+ ttf-dejavu \
+ ttf-liberation && \
+ fc-cache -f -v
+
+# Set proper permissions
+RUN chown -R nocodb:nocodb /usr/src/app
# Copy production code & main entry file
COPY --link --from=builder /usr/src/app/ /usr/src/app/
COPY --link --from=builder /usr/src/appEntry/ /usr/src/appEntry/
+# Switch to non-root user
+USER nocodb
+
EXPOSE 8080
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
# Start NocoDB
-CMD ["/usr/src/appEntry/start.sh"]
+CMD ["/usr/src/appEntry/start.sh"]
\ No newline at end of file