Skip to content

Commit 73035b5

Browse files
committed
Publish airgapped image using stripped down preview server
1 parent ca3951e commit 73035b5

File tree

4 files changed

+22
-45
lines changed

4 files changed

+22
-45
lines changed

air_gapped/Dockerfile

Lines changed: 10 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,14 @@
1-
FROM docker.elastic.co/docs/preview:latest AS build
1+
FROM cgr.dev/chainguard/wolfi-base
22

3-
COPY air_gapped/work/target_repo.git /docs_build/.repos/target_repo.git
4-
5-
FROM chainguard/wolfi-base:latest
6-
#FROM perl:5.42-bookworm
7-
RUN apk update
8-
RUN apk add perl
9-
RUN apk add curl
10-
RUN apk add perl-app-cpanminus
11-
12-
RUN apk add gcc make git patch perl-dev wget
13-
RUN apk add openssl-dev
14-
RUN apk add zlib-dev
15-
RUN apk add perl-net-ssleay
16-
17-
ENV PERL5LIB=/usr/local/lib/perl5
18-
ENV PATH=/usr/local/bin:$PATH
3+
RUN apk update && apk add nodejs git npm
194

20-
WORKDIR /
21-
RUN cpanm -n XML::LibXML
22-
RUN cpanm -n File::Copy::Recursive
23-
RUN cpanm -n Path::Class
24-
RUN cpanm -n Parallel::ForkManager
25-
RUN cpanm -n YAML
26-
#RUN apt update -y
27-
#RUN apt-get install -y perl
28-
#RUN apt-get install -y nginx
29-
#RUN apt-get install -y nodejs
30-
#RUN apt-get install -y git
31-
32-
#RUN apt-get install -y libxml-simple-perl
33-
#RUN apt-get install -y libfile-copy-recursive-perl
34-
#RUN apt-get install -y libpath-class-perl
35-
#RUN apt-get install -y libcapture-tiny-perl
36-
#RUN apt-get install -y libparallel-forkmanager-perl
37-
#RUN apt-get install -y libyaml-perl
38-
39-
RUN apk add nginx
40-
RUN apk add nodejs
41-
42-
COPY --from=build /docs_build /docs_build
43-
COPY --from=build /node_modules /node_modules
5+
WORKDIR /app
6+
COPY air_gapped/work/target_repo.git /docs_build/.repos/target_repo.git
7+
COPY --chown=node:node preview /app/preview/
8+
COPY --chown=node:node template /app/template/
9+
COPY --chown=node:node preview/package.json /app/package.json
10+
WORKDIR /app
11+
RUN npm install
4412

45-
RUN adduser -D nginx
46-
RUN mkdir -p /var/lib/nginx/tmp/
13+
ENTRYPOINT ["node", "preview/cli.js", "git", "/docs_build/.repos/target_repo.git"]
4714

48-
CMD ["/docs_build/build_docs.pl", "--in_standard_docker", "--gapped", "--preview"]

air_gapped/Dockerfile.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
*
22
!air_gapped
3+
!preview
4+
!template

preview/package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"license": "SEE LICENSE IN README.asciidoc",
3+
"dependencies": {
4+
"yargs": "^14.0.0",
5+
"dedent": "^0.7.0",
6+
"recursive-copy": "^2.0.10"
7+
}
8+
}

preview/preview.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ const checkRedirects = async (core, path) => {
188188

189189
module.exports = Core => {
190190
const server = http.createServer((request, response) => {
191-
const parsedUrl = url.parse(request.url);
191+
//const parsedUrl = url.parse(request.url);
192+
const parsedUrl = new URL(`http://${process.env.HOST ?? 'localhost'}${request.url}`);
192193
const prefix = hostPrefix(request.headers['host']);
193194
const core = Core(prefix);
194195
requestHandler(core, parsedUrl, response)

0 commit comments

Comments
 (0)