Skip to content

Commit 29b07dd

Browse files
authored
Update Dockerfile
1 parent d140abe commit 29b07dd

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

Dockerfile

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
1-
# Use an older, compatible Node.js image (v10)
1+
# Use the Node.js v10 image required for the old gitbook-cli
22
FROM node:10-alpine
33

44
# Set working directory
55
WORKDIR /app
66

7-
# Alpine Linux is used, so we use 'apk' to install git
7+
# Install git
88
RUN apk add --no-cache git
99

10-
# Install GitBook CLI globally
10+
# Install the GitBook command line tool
1111
RUN npm install -g gitbook-cli
1212

13-
# Initialize GitBook by fetching a specific, stable version
13+
# Tell gitbook-cli to download the stable 3.2.3 engine
1414
RUN gitbook fetch 3.2.3
1515

16-
# Copy your documentation files to the container
16+
# Copy your local files (book.json, markdown, etc.) into the container
1717
COPY . .
1818

19-
# Create a default book.json if one doesn't exist
20-
RUN if [ ! -f "book.json" ]; then \
21-
echo '{"title": "My Documentation", "description": "Documentation served with GitBook"}' > book.json; \
22-
fi
19+
# --- THIS IS THE FIX FOR THE "NOT FOUND" ERROR ---
20+
# We are forcing the old npm client to use the public registry directly
21+
# and to ignore the SSL protocol errors that are likely causing the block.
22+
RUN npm config set registry https://registry.npmjs.org/
23+
RUN npm config set "strict-ssl" false
2324

24-
# Install GitBook plugins (if any are specified in book.json)
25+
# Install the plugins listed in book.json using the now-fixed npm client
2526
RUN gitbook install
2627

27-
# Build the static site
28+
# Build the static HTML site
2829
RUN gitbook build
2930

30-
# Expose a port (using 4000 as a standard for gitbook serve)
31+
# Expose port 4000 for serving
3132
EXPOSE 4000
3233

33-
# Serve the built documentation on all network interfaces
34+
# The command to run when the container starts
3435
CMD ["gitbook", "serve", "--port", "4000", "--host", "0.0.0.0"]

0 commit comments

Comments
 (0)