Skip to content

Commit e001d04

Browse files
committed
Fix express init
Add docker image
1 parent b44255f commit e001d04

File tree

2 files changed

+73
-14
lines changed

2 files changed

+73
-14
lines changed

benchkit/Dockerfile

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
FROM ubuntu:20.04
2+
3+
ARG NODE_VERSION=16
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
ENV NODE_OPTIONS --max_old_space_size=4096 --use-openssl-ca
6+
7+
# Configuring NodeJS version
8+
RUN apt-get clean
9+
10+
RUN apt-get update && \
11+
apt-get upgrade -y && \
12+
apt-get install -y curl
13+
14+
RUN curl -sL https://deb.nodesource.com/setup_${NODE_VERSION:=10}.x | sh
15+
16+
RUN apt-get update && \
17+
apt-get upgrade -y && \
18+
apt-get install -y \
19+
git \
20+
curl \
21+
python3 \
22+
nodejs \
23+
firefox \
24+
nodejs \
25+
unzip \
26+
&& rm -rf /var/lib/apt/lists/*
27+
28+
RUN /bin/bash -c "hash -d npm"
29+
30+
# Enable tls v1.0
31+
RUN echo "openssl_conf = openssl_configuration\n"|cat - /etc/ssl/openssl.cnf > /tmp/openssl_conf.cnf \
32+
&& mv /tmp/openssl_conf.cnf /etc/ssl/openssl.cnf
33+
RUN echo "[openssl_configuration]\n\
34+
ssl_conf = ssl_configuration\n\
35+
[ssl_configuration]\n\
36+
system_default = tls_system_default\n\
37+
[tls_system_default]\n\
38+
CipherString = DEFAULT:@SECLEVEL=1" >> /etc/ssl/openssl.cnf
39+
40+
RUN update-ca-certificates --verbose
41+
42+
RUN useradd -m driver && echo "driver:driver" | chpasswd && adduser driver sudo
43+
VOLUME /driver
44+
RUN chown -Rh driver:driver /home/driver
45+
WORKDIR /home/driver
46+
47+
USER driver
48+
WORKDIR /home/driver
49+
CMD /bin/bash
50+
RUN mkdir /home/driver/.npm_global
51+
RUN npm config set prefix /home/driver/.npm_global
52+
53+
# Build stuff
54+
ADD --chown=driver:driver . /home/driver
55+
56+
RUN ls -lf ..
57+
RUN npm ci
58+
RUN npm run build
59+
60+
CMD ["npm", "run", "start-benchkit-backend"]

packages/benchkit-backend/src/index.js

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,19 @@ const driver = neo4j.driver(neo4jUrl, neo4j.auth.basic(config.username, config.p
1010
})
1111
const executor = WorkloadExecutor(driver)
1212

13-
const app = express()
14-
15-
app.use(express.json({
16-
type: 'application/json'
17-
}))
18-
app.use(config.workloadRoute, WorkloadRouter(executor.execute, config.workloadRoute))
19-
app.use((err, _req, res, _) => {
20-
console.log(err)
21-
res.status(err.status || 500).end()
22-
})
23-
24-
const server = app.listen(config.backendPort, () => {
25-
console.log(`index.js:${process.pid}:Listening on ${config.backendPort}`)
26-
})
13+
const server = express()
14+
.disable('x-powered-by')
15+
.use(express.json({
16+
type: 'application/json'
17+
}))
18+
.use(config.workloadRoute, WorkloadRouter(executor.execute, config.workloadRoute))
19+
.use((err, _req, res, _) => {
20+
console.log(err)
21+
res.status(err.status || 500).end()
22+
})
23+
.listen(config.backendPort, () => {
24+
console.log(`index.js:${process.pid}:Listening on ${config.backendPort}`)
25+
})
2726

2827
process.on('SIGTERM', () => {
2928
console.debug('SIGTERM signal received: closing HTTP server')

0 commit comments

Comments
 (0)