forked from godotengine/godot-docs
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Stage 1: Build documentation using Sphinx | ||
FROM ubuntu:22.04 AS sphinx-build | ||
|
||
# Set working directory | ||
WORKDIR /docs | ||
|
||
# Install necessary dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
python3-pip \ | ||
make \ | ||
dos2unix \ | ||
recode \ | ||
parallel \ | ||
libwebp7 \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy requirements.txt and install pip dependencies | ||
COPY requirements.txt . | ||
|
||
RUN pip3 install -r requirements.txt | ||
RUN pip3 install codespell | ||
|
||
# Copy the rest of the documentation files | ||
COPY . . | ||
|
||
# Create the output directory | ||
RUN mkdir -p _build/html | ||
|
||
# Build HTML documentation using Sphinx | ||
RUN make SPHINXOPTS='--color' html | ||
|
||
# Stage 2: Serve the built documentation using Nginx | ||
FROM nginx:alpine | ||
|
||
# Copy built HTML documentation from the previous stage | ||
COPY --from=sphinx-build /docs/_build/html /usr/share/nginx/html | ||
|
||
# Add custom Nginx config for health check | ||
COPY nginx.conf /etc/nginx/nginx.conf | ||
|
||
# Expose port 8080 for serving | ||
EXPOSE 8080 | ||
|
||
# Healthcheck to ensure Nginx is serving correctly | ||
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \ | ||
CMD curl -f http://localhost:8080/health || exit 1 | ||
|
||
# Start Nginx | ||
CMD ["nginx", "-g", "daemon off;"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
worker_processes 1; | ||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
include mime.types; # Include default mime types | ||
default_type application/octet-stream; # Default type if not matched | ||
|
||
server { | ||
listen 8080; | ||
|
||
# Serve the documentation files | ||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html; | ||
try_files $uri $uri/ =404; # Handle missing files | ||
} | ||
|
||
# Health check endpoint | ||
location /health { | ||
access_log off; # Disable access logs for health check | ||
return 200 'OK'; | ||
add_header Content-Type text/plain; | ||
} | ||
} | ||
} |