Skip to content

Commit bc6121e

Browse files
committed
fix Docker image
1 parent 0755d26 commit bc6121e

File tree

3 files changed

+29
-11
lines changed

3 files changed

+29
-11
lines changed

Diff for: Dockerfile

+13-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ RUN apt-get install -y python3 m4 libtinfo5 libghc-zlib-dev rsync ghc haskell-st
1414

1515
ENV NVM_DIR /usr/local/nvm
1616
RUN mkdir -p $NVM_DIR
17-
ENV NODE_VERSION 16.13.2
17+
ENV NODE_VERSION 16.15.1
1818
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash
1919

2020
# install node and npm
@@ -31,10 +31,6 @@ RUN mkdir /server
3131
RUN mkdir /build
3232
RUN mkdir /src
3333

34-
COPY package.json /server
35-
WORKDIR /server
36-
RUN npm install
37-
3834
# Volume before chown changes owwner
3935
VOLUME /src
4036
VOLUME /build
@@ -45,10 +41,20 @@ WORKDIR /build
4541
RUN dos2unix /root/install_rust.sh
4642
RUN bash /root/install_rust.sh
4743

44+
# Create server
45+
46+
COPY server /server
47+
WORKDIR /server
48+
RUN npm install
49+
4850
# USER user
4951

5052
RUN npm install
51-
COPY lws.config.js /server
5253
EXPOSE 8080
53-
CMD ["/server/node_modules/.bin/ws","-c","/server/lws.config.js","--static.maxage", "1"]
54+
WORKDIR /build
55+
CMD ["mkdir", "/build/frameworks"]
56+
CMD ["mkdir", "/build/frameworks/keyed"]
57+
CMD ["mkdir", "/build/frameworks/non-keyed"]
58+
CMD ["/server/runserver-docker.sh"]
59+
#CMD ["node","index.js"]
5460

Diff for: server/index.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ const fsp = require('fs/promises');
66
const app = express()
77
const port = 8080
88

9+
let frameworkDirectory = path.join(__dirname, "..", "frameworks");
10+
11+
if (process.argv.length===3) {
12+
console.log("Changing working directory to "+process.argv[2]);
13+
frameworkDirectory = process.argv[2];
14+
}
15+
916
async function loadFrameworkInfo(keyedDir, directoryName) {
1017
let result = {
1118
type: keyedDir,
@@ -22,7 +29,7 @@ async function loadFrameworkInfo(keyedDir, directoryName) {
2229
result.buttonsInShadowRoot = useShadowRoot ? (packageJSON["js-framework-benchmark"]["buttonsInShadowRoot"] ?? true) : undefined;
2330
}
2431

25-
const frameworkPath = path.resolve("..", "frameworks", keyedDir, directoryName);
32+
const frameworkPath = path.resolve(frameworkDirectory, keyedDir, directoryName);
2633
const packageJSONPath = path.resolve(frameworkPath, "package.json");
2734
const packageLockJSONPath = path.resolve(frameworkPath, "package-lock.json");
2835
if (fs.existsSync(packageJSONPath)) {
@@ -62,7 +69,7 @@ async function loadFrameworkVersionInformation(filterForFramework) {
6269
// frameworkArgument.length == 0 || frameworkArgument.some((arg: string) => arg == directoryName);
6370

6471
let resultsProm = [];
65-
let frameworksPath = path.resolve("..", "frameworks");
72+
let frameworksPath = path.resolve(frameworkDirectory);
6673
for (keyedType of ["keyed", "non-keyed"]) {
6774
let directories = fs.readdirSync(path.resolve(frameworksPath, keyedType));
6875
for (let directory of directories) {
@@ -76,8 +83,8 @@ async function loadFrameworkVersionInformation(filterForFramework) {
7683
return Promise.all(resultsProm);
7784
}
7885

79-
app.use('/frameworks', express.static(path.join(__dirname, '..', 'frameworks')))
80-
app.use('/css', express.static(path.join(__dirname, '..', 'css')))
86+
app.use('/frameworks', express.static(frameworkDirectory))
87+
app.use('/css', express.static(path.join(frameworkDirectory, '..', 'css')))
8188

8289
app.get('/ls', async (req, res) => {
8390
let t0 = Date.now();

Diff for: server/runserver-docker.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
echo "Starting server"
3+
source /usr/local/nvm/nvm.sh
4+
cd /server
5+
node index.js /build/frameworks

0 commit comments

Comments
 (0)