Skip to content

Commit 91bfd6c

Browse files
committed
Add Docker Compose for the static site
1 parent c969216 commit 91bfd6c

7 files changed

Lines changed: 69 additions & 2 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ The live website is a static Next.js application in [`web/`](web/README.md). Git
77
[Update and deployment workflow](https://github.com/UFFeScience/uffescience.github.io/actions/workflows/pages.yml) runs weekly on Monday at 09:00 Brasília and can be run manually. Apify credentials are stored only in Actions Secrets and ignored local environment files.
88

99
See [development and content documentation](web/README.md) for local preview, synchronization, storage and deployment details.
10+
11+
To run locally with Docker, execute `docker compose up --build -d` from this directory, then open http://localhost:8080/. Stop it with `docker compose down`.

‎compose.yml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: uffescience
2+
3+
services:
4+
web:
5+
build:
6+
context: ./web
7+
ports:
8+
- '127.0.0.1:${PORT:-8080}:80'
9+
restart: unless-stopped

‎web/.dockerignore‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
node_modules
2+
.next
3+
out
4+
.env*
5+
public/media
6+
data/sync.lock
7+
data/*.tmp
8+
data/sync*.log
9+
scripts/__pycache__
10+
.venv
11+
*.log
12+
.DS_Store

‎web/Dockerfile‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM node:22-alpine AS build
2+
3+
WORKDIR /app
4+
ENV NEXT_TELEMETRY_DISABLED=1
5+
6+
COPY package.json package-lock.json ./
7+
RUN npm ci
8+
9+
COPY . .
10+
RUN npm run build && node scripts/check-static.mjs
11+
12+
FROM nginx:stable-alpine AS runtime
13+
14+
COPY nginx.conf /etc/nginx/conf.d/default.conf
15+
COPY --from=build /app/out /usr/share/nginx/html
16+
17+
EXPOSE 80

‎web/README.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,20 @@ python3 -m http.server 3007 --directory out
1515

1616
`npm run dev -- --port 3007` is also available for editing. No deployed Node.js server, API routes, ISR or remote image optimization is required. Every publication slug and historical alias is generated during the build. HTML, CSS, JavaScript and archived images are published from `out/`.
1717

18+
## Docker Compose
19+
20+
From the repository root (the directory containing `compose.yml`):
21+
22+
```sh
23+
docker compose up --build -d
24+
docker compose logs -f web
25+
docker compose down
26+
```
27+
28+
Open http://localhost:8080/. To use another port, run `PORT=8081 docker compose up --build -d`.
29+
30+
The multi-stage image builds and validates the static export with Node.js, then serves it with Nginx. It includes the stored content and archived images; no Apify or GitHub credentials are needed or copied into the image. Individual publication URLs work directly, and unknown paths return HTTP 404. Run the build command again after changing source or stored content. Content collection remains in the weekly GitHub Actions workflow.
31+
1832
## Stored content
1933

2034
- `data/publications.json`: full publication history, stable slugs, authors, dates, original LinkedIn links, deduplication aliases and collection metadata.

‎web/nginx.conf‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
server {
2+
listen 80;
3+
server_name _;
4+
5+
root /usr/share/nginx/html;
6+
index index.html;
7+
8+
location / {
9+
try_files $uri $uri/ =404;
10+
}
11+
12+
error_page 404 /404.html;
13+
}

‎web/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"sync:weekly": "node scripts/sync-weekly.mjs",
1111
"prebuild": "node scripts/prepare-static.mjs",
1212
"sync:github": "node scripts/sync-github.mjs",
13-
"format": "prettier --write app lib scripts next.config.mjs package.json README.md ../README.md ../.github ../.prettierrc.json",
14-
"format:check": "prettier --check app lib scripts next.config.mjs package.json README.md ../README.md ../.github ../.prettierrc.json",
13+
"format": "prettier --write app lib scripts next.config.mjs package.json README.md ../README.md ../.github ../.prettierrc.json ../compose.yml",
14+
"format:check": "prettier --check app lib scripts next.config.mjs package.json README.md ../README.md ../.github ../.prettierrc.json ../compose.yml",
1515
"format:python": "python3 -m black scripts",
1616
"format:python:check": "python3 -m black --check scripts"
1717
},

0 commit comments

Comments
 (0)