chore: 基础镜像中添加pdf.js

This commit is contained in:
jmal 2024-06-22 18:28:02 +08:00
parent e1dc73556e
commit 9cf0376c4b
3 changed files with 30 additions and 1 deletions

View File

@ -6,12 +6,18 @@ RUN mkdir -p /etc/nginx/servers /var/www
RUN wget https://github.com/jgraph/drawio/releases/download/v24.4.10/draw.war -O /var/www/draw.war
RUN wget https://github.com/mozilla/pdf.js/releases/download/v4.3.136/pdfjs-4.3.136-dist.zip -O /var/www/pdfjs.zip
RUN unzip /var/www/draw.war -d /var/www/draw
RUN rm -rf /var/www/draw.war /var/www/draw/META-INF /var/www/draw/WEB-INF
RUN unzip /var/www/pdfjs.zip -d /var/www/pdfjs
RUN rm -rf /var/www/pdfjs.zip /var/www/draw.war /var/www/draw/META-INF /var/www/draw/WEB-INF
RUN apt-get remove -y unzip wget && \
apt-get autoremove -y && \
apt-get clean
COPY docker/nginx-drawio/drawio.conf /etc/nginx/servers/drawio.conf
COPY docker/nginx-drawio/pdfjs.conf /etc/nginx/servers/pdfjs.conf

View File

@ -0,0 +1,5 @@
server {
listen 8081;
server_name localhost;
root /var/www/pdfjs;
}

View File

@ -195,6 +195,24 @@ http {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
location /pdf.js/ {
proxy_pass http://localhost:8081/;
proxy_http_version 1.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-PORT $remote_port;
proxy_set_header X-Forwarded-Host $the_host//pdf.js;
proxy_set_header X-Forwarded-Proto $the_scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header Scheme $scheme;
proxy_set_header Server-Protocol $server_protocol;
proxy_set_header Server-Name $server_name;
proxy_set_header Server-Addr $server_addr;
proxy_set_header Server-Port $server_port;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
include servers/*;