mirror of
https://github.com/mleem97/gregWiki.git
synced 2026-04-10 19:19:18 +02:00
chore(docker): compose, entrypoint guard, LF shell script; format with Prettier
- Add docker-compose.yml (build context .) and .gitattributes for entrypoint LF - README: document docker compose and gregWiki root requirement - package.json: include docker-compose.yml in npm run format Made-with: Cursor
This commit is contained in:
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
docker-entrypoint.sh text eol=lf
|
||||||
@@ -1,10 +1,15 @@
|
|||||||
# Build context: this repository root (gregWiki).
|
# Build context MUST be this repository root (directory containing package.json).
|
||||||
# Runs the Docusaurus dev server with hot reload.
|
# Correct: docker build -t gregwiki .
|
||||||
|
# Wrong: docker build -f gregWiki/Dockerfile .. → COPY fails or image has no package.json
|
||||||
|
# Dev server with hot reload. For production static files use: npm run build + any static host.
|
||||||
FROM node:20-alpine
|
FROM node:20-alpine
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ENV NODE_OPTIONS="--max-old-space-size=4096"
|
ENV NODE_OPTIONS="--max-old-space-size=4096"
|
||||||
|
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
||||||
|
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||||
COPY package.json package-lock.json ./
|
COPY package.json package-lock.json ./
|
||||||
RUN npm ci --ignore-scripts
|
RUN npm ci --ignore-scripts
|
||||||
COPY . .
|
COPY . .
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||||
CMD ["npm", "run", "start", "--", "--host", "0.0.0.0", "--port", "3000"]
|
CMD ["npm", "run", "start", "--", "--host", "0.0.0.0", "--port", "3000"]
|
||||||
|
|||||||
@@ -24,9 +24,11 @@ Optional: refresh the legacy GitHub Wiki mirror from a sibling `../.wiki/` clone
|
|||||||
|
|
||||||
## Docker
|
## Docker
|
||||||
|
|
||||||
Build context is this repository root:
|
Build context **must** be this repository root (the folder that contains `package.json`):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
docker compose up --build
|
||||||
|
# or
|
||||||
docker build -t gregwiki-docs .
|
docker build -t gregwiki-docs .
|
||||||
docker run --rm -p 3000:3000 gregwiki-docs
|
docker run --rm -p 3000:3000 gregwiki-docs
|
||||||
```
|
```
|
||||||
|
|||||||
11
docker-compose.yml
Normal file
11
docker-compose.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Run from this directory (gregWiki repo root): docker compose up --build
|
||||||
|
# Wrong context (e.g. monorepo parent) causes: ENOENT /app/package.json
|
||||||
|
services:
|
||||||
|
wiki:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- '3000:3000'
|
||||||
|
environment:
|
||||||
|
CHOKIDAR_USEPOLLING: 'true'
|
||||||
@@ -1,14 +1,12 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
# Prefer wiki subfolder when the repo root is mounted at /app (root also has package.json).
|
if [ ! -f /app/package.json ]; then
|
||||||
# Otherwise use /app when only ./wiki is bound there (compose: ./wiki:/app).
|
echo "docker-entrypoint: ERROR: /app/package.json not found." >&2
|
||||||
if [ -f /app/wiki/package.json ]; then
|
echo " Build context must be the gregWiki repo root (the folder that contains package.json)." >&2
|
||||||
cd /app/wiki
|
echo " Example: cd path/to/gregWiki && docker build -t gregwiki ." >&2
|
||||||
elif [ -f /app/package.json ]; then
|
echo " Not: docker build -f gregWiki/Dockerfile .. (wrong context)" >&2
|
||||||
cd /app
|
echo " Compose: run from gregWiki so build.context is '.' — see docker-compose.yml." >&2
|
||||||
else
|
echo " If you use a volume on /app, it must map to that repo root, not an empty dir." >&2
|
||||||
echo "docker-entrypoint: no package.json under /app or /app/wiki." >&2
|
|
||||||
echo "Run docker compose from the repository root so ./wiki is mounted, then: docker compose build --no-cache docs" >&2
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
"wiki:sync": "node ./scripts/sync-wiki-to-docs.mjs",
|
"wiki:sync": "node ./scripts/sync-wiki-to-docs.mjs",
|
||||||
"wiki:normalize-i18n": "node ./scripts/normalize-wiki-import-i18n.mjs",
|
"wiki:normalize-i18n": "node ./scripts/normalize-wiki-import-i18n.mjs",
|
||||||
"wiki:refresh": "node ./scripts/sync-wiki-to-docs.mjs && node ./scripts/normalize-wiki-import-i18n.mjs",
|
"wiki:refresh": "node ./scripts/sync-wiki-to-docs.mjs && node ./scripts/normalize-wiki-import-i18n.mjs",
|
||||||
"format": "prettier --write src scripts docusaurus.config.js sidebars.js README.md docs/README.md package.json .prettierrc.json",
|
"format": "prettier --write src scripts docusaurus.config.js sidebars.js README.md docs/README.md package.json .prettierrc.json docker-compose.yml",
|
||||||
"format:check": "prettier --check src scripts docusaurus.config.js sidebars.js README.md docs/README.md package.json .prettierrc.json"
|
"format:check": "prettier --check src scripts docusaurus.config.js sidebars.js README.md docs/README.md package.json .prettierrc.json docker-compose.yml"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@docusaurus/core": "3.9.2",
|
"@docusaurus/core": "3.9.2",
|
||||||
|
|||||||
Reference in New Issue
Block a user