Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ikrong committed Jul 9, 2024
1 parent 9b3b32d commit 596bd5e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
NODE_PATH=$(npm root --quiet -g) node ./tools/prepare.js repo-revision docker/docs
- name: Build docker doc
run: |
docker buildx build --build-arg DOCS_URL=/ --load -t docs:latest ./docker-docs/
docker buildx build --load -t docs:latest ./docker-docs/
docker container create --name docs docs:latest /bin/sh
docker container cp docs:/ ./docker/html/
docker container rm -f docs
Expand Down
9 changes: 5 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ FROM --platform=linux/amd64 node:20 AS node

COPY . /app

# RUN <<EOF
# /app/tools/install.sh
# NODE_PATH=$(npm root --quiet -g) node /app/tools/index.js /app/html/
# EOF
RUN <<EOF
/app/tools/install.sh
NODE_PATH=$(npm root --quiet -g) node /app/replace.js /app/html/
NODE_PATH=$(npm root --quiet -g) node /app/tools/index.js /app/html/
EOF

FROM ikrong/mini-http:latest
ARG DOCWORLD_SOURCE
Expand Down
15 changes: 15 additions & 0 deletions docker/replace.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const fs = require("fs");
const path = require("path");
const fetch = require("node-fetch");
const cheerio = require("cheerio");
const glob = require("glob").globSync;

const HOST_DIR = process.argv[2];

!(() => {
const matchFiles = glob(path.join(HOST_DIR, "./**/*.{html,js,css}"));
for (const file of matchFiles) {
const content = fs.readFileSync(file).toString();
fs.writeFileSync(file, content.replace(/https:\/\/docs\.docker\.com\//g, '/'));
}
})();

0 comments on commit 596bd5e

Please sign in to comment.