Skip to content

Commit 84e6195

Browse files
benjay10madnificent
authored andcommitted
Merging @erikap's branch with @benjay10's
1 parent 8178a63 commit 84e6195

File tree

5 files changed

+68
-44
lines changed

5 files changed

+68
-44
lines changed

Dockerfile

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,28 @@
1-
FROM nginx:1.15.8
2-
LABEL maintainer="[email protected]"
1+
FROM node:16-alpine as builder
32

4-
ENV ENABLE_ENDPOINT_SELECTOR false
5-
ENV DEFAULT_SPARQL_ENDPOINT http://localhost/sparql
3+
LABEL maintainer="[email protected]"
64

7-
COPY index.html /usr/share/nginx/html/
8-
COPY startup.sh /
9-
RUN chmod +x /startup.sh
5+
RUN apk add bash
6+
RUN apk add git
7+
RUN apk add yarn
8+
RUN mkdir /app
9+
WORKDIR /app
10+
RUN git clone https://github.com/TriplyDB/Yasgui.git
11+
WORKDIR /app/Yasgui
12+
RUN yarn install
13+
RUN yarn run build
1014

11-
ENTRYPOINT ["/startup.sh"]
15+
FROM httpd:alpine3.19
1216

13-
CMD ["nginx", "-g", "daemon off;"]
17+
WORKDIR /usr/local/apache2/htdocs
18+
COPY --from=builder /app/Yasgui/build .
19+
COPY --from=builder /app/Yasgui/packages/yasgui/static/yasgui.polyfill.min.js .
20+
COPY --from=builder /app/Yasgui/webpack/yasgui.png .
21+
COPY ./index-replacement.html .
22+
COPY ./FixHostedFiles.sh /
23+
COPY ./startup.sh /
24+
RUN sh /FixHostedFiles.sh
25+
26+
ENV DEFAULT_SPARQL_ENDPOINT http://localhost:8890/sparql
27+
ENTRYPOINT ["sh", "/startup.sh"]
28+
CMD ["httpd-foreground"]

FixHostedFiles.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
3+
cd /usr/local/apache2/htdocs
4+
rm index.html yasgui.html yasr.html yasqe.html
5+
mv index-replacement.html index.html
6+

index-replacement.html

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<link rel="icon" type="image/x-icon" href="yasgui.png">
6+
<style>
7+
body {
8+
font-family: 'Roboto', sans-serif;
9+
margin: 0px;
10+
}
11+
</style>
12+
<script src="./yasgui.polyfill.min.js"></script>
13+
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
14+
<title>YASGUI</title>
15+
<link href="/yasgui.min.css" rel="stylesheet">
16+
<link href="/yasqe.min.css" rel="stylesheet">
17+
<link href="/yasr.min.css" rel="stylesheet">
18+
</head>
19+
<body>
20+
<div id="yasgui"></div>
21+
<script>
22+
window.onpageshow = function () {
23+
window.yasgui = new Yasgui(document.getElementById("yasgui"), {
24+
corsProxy: "",
25+
requestConfig: {
26+
endpoint: "~DEFAULT_SPARQL_ENDPOINT~",
27+
}
28+
});
29+
};
30+
</script>
31+
<script src="/yasgui.min.js"></script>
32+
<script src="/yasqe.min.js"></script>
33+
<script src="/yasr.min.js"></script>
34+
</body>
35+
</html>

index.html

Lines changed: 0 additions & 26 deletions
This file was deleted.

startup.sh

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
#!/bin/bash
1+
#!/bin/sh
22

3-
if [ "$ENABLE_ENDPOINT_SELECTOR" == "true" ];
4-
then
5-
sed -i '/\/\*\* endpoint-selector \*\//c\'"\/** .yasgui .endpointText {display:none !important;} *\/ \/** endpoint-selector *\/" /usr/share/nginx/html/index.html
6-
else
7-
sed -i '/\/\*\* endpoint-selector \*\//c\'".yasgui .endpointText {display:none !important;} \/** endpoint-selector *\/" /usr/share/nginx/html/index.html
8-
fi
9-
10-
sed -i '/default SPARQL endpoint/c\'"yasqe:{sparql:{endpoint:'$DEFAULT_SPARQL_ENDPOINT'}} \/\/ default SPARQL endpoint" /usr/share/nginx/html/index.html
3+
cd /usr/local/apache2/htdocs
4+
sed -i "s@~DEFAULT_SPARQL_ENDPOINT~@$DEFAULT_SPARQL_ENDPOINT@g" index.html
115

126
exec "$@"

0 commit comments

Comments
 (0)