Skip to content

Commit ee6453d

Browse files
authored
Merge pull request #1 from ewdurbin/dockerize
dockerize for cabotage
2 parents 5a4dd49 + 3576425 commit ee6453d

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed

.cabotage/nginx.conf

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
worker_processes auto;
2+
pid /tmp/nginx.pid;
3+
error_log /dev/stderr;
4+
5+
events {
6+
worker_connections 1024;
7+
}
8+
9+
http {
10+
include /etc/nginx/mime.types;
11+
default_type application/octet-stream;
12+
13+
access_log /dev/stdout;
14+
15+
sendfile on;
16+
keepalive_timeout 65;
17+
18+
client_body_temp_path /tmp/nginx_client_body;
19+
proxy_temp_path /tmp/nginx_proxy;
20+
fastcgi_temp_path /tmp/nginx_fastcgi;
21+
uwsgi_temp_path /tmp/nginx_uwsgi;
22+
scgi_temp_path /tmp/nginx_scgi;
23+
24+
server {
25+
listen unix:/var/run/cabotage/cabotage.sock;
26+
server_name _;
27+
28+
location / {
29+
root /usr/share/nginx/html;
30+
index index.html;
31+
}
32+
33+
error_page 500 502 503 504 /50x.html;
34+
location = /50x.html {
35+
root /usr/share/nginx/html;
36+
}
37+
}
38+
}

Dockerfile.cabotage

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Stage 1: Build the docs (mirrors .readthedocs.yml)
2+
FROM python:3 AS builder
3+
4+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
5+
6+
WORKDIR /docs
7+
8+
# Install deps first (cached layer + mount cache for uv)
9+
COPY requirements.txt Makefile ./
10+
RUN --mount=type=cache,target=/root/.cache/uv \
11+
make ensure-venv
12+
13+
COPY . .
14+
15+
# Build dirhtml, same as RTD: make dirhtml BUILDDIR=_readthedocs
16+
RUN make dirhtml BUILDDIR=_readthedocs
17+
18+
# Stage 2: Serve via nginx
19+
FROM nginx:alpine
20+
21+
COPY .cabotage/nginx.conf /etc/nginx/nginx.conf
22+
RUN rm /etc/nginx/conf.d/default.conf && \
23+
mkdir -p /var/run/cabotage && \
24+
chown nobody:nobody /var/run/cabotage
25+
26+
COPY --from=builder /docs/_readthedocs/dirhtml /usr/share/nginx/html
27+
28+
USER nobody

Procfile.cabotage

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: nginx -g 'daemon off;'

0 commit comments

Comments
 (0)