File size: 1,700 Bytes
1e3ae4a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Use an official NocoDB image
# You can pin to a specific version for stability if needed, e.g., nocodb/nocodb:0.204.4
FROM nocodb/nocodb:latest

# NocoDB listens on port 8080 by default within the container.
ENV PORT=8080
ENV NODE_ENV=production

# --- Prepare SQLite data directory and configure SQLite specifically ---
USER root

# Create the directory for the SQLite database file
RUN mkdir -p /usr/app/data && \
    chown -R node:node /usr/app/data

# Explicitly tell NocoDB to use SQLite and where to store the database file.
ENV NC_DB_TYPE="sqlite3"
ENV NC_SQLITE_FILENAME="/usr/app/data/noco.db"

# The base nocodb/nocodb image will switch back to USER node.
# USER node

# --- IMPORTANT FOR PRODUCTION/PERSISTENCE ---
# 1. For any serious use, DO NOT rely on SQLite within the container.
#    Data will be lost if the Space restarts or is rebuilt.
#    Configure an EXTERNAL database (PostgreSQL, MySQL, etc.) by setting
#    the appropriate NC_DB or DATABASE_URL as a SECRET in your Hugging Face Space settings.
#    Example for PostgreSQL:
#    NC_DB="pg://USER:PASSWORD@HOST:PORT/DATABASE_NAME"
#    (If using NC_DB for an external database, you would REMOVE NC_DB_TYPE and NC_SQLITE_FILENAME)

# 2. Set NC_AUTH_JWT_SECRET as a SECRET in your Hugging Face Space settings.
#    This is crucial for securing authentication tokens.
#    Generate a strong random string for this value.
#    Example:
#    NC_AUTH_JWT_SECRET="your_very_strong_random_jwt_secret_here"
# ---

# Expose the port NocoDB listens on.
# This port will be mapped by Hugging Face Spaces based on your README.md app_port.
EXPOSE 8080

# The default command for the nocodb/nocodb image is already set up to start NocoDB.