Skip to content
13 changes: 6 additions & 7 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
FROM node:11.1.0-alpine

RUN apk add nss git openjdk8-jre openjdk8 maven python alpine-sdk libxml2-dev yarn g++ gcc bash raptor2 jq
RUN apk add nss git openjdk8-jre openjdk8 maven python alpine-sdk libxml2-dev yarn g++ gcc bash raptor2 jq curl

WORKDIR /synbiohub
COPY . .

RUN git config --global url."https://".insteadOf git://
RUN chmod +x docker/saveconfig.sh && ./docker/saveconfig.sh
RUN rm -rf .git

RUN cd java && mvn package
RUN git config --global url."https://".insteadOf git://
RUN yarn install

RUN mkdir /mnt/data && \
Expand All @@ -19,8 +20,6 @@ RUN mkdir /mnt/data && \
mkdir /mnt/config

COPY docker/config.local.json /mnt/config/config.local.json
COPY docker/healthcheck.js healthcheck.js
COPY docker/entry.sh entry.sh

RUN ln -s /mnt/config/config.local.json ./config.local.json && \
touch /mnt/data/synbiohub.sqlite && ln -s /mnt/data/synbiohub.sqlite ./synbiohub.sqlite && \
Expand All @@ -30,7 +29,7 @@ RUN ln -s /mnt/config/config.local.json ./config.local.json && \
ln -s /mnt/data/icons public/.

EXPOSE 7777
HEALTHCHECK --interval=10s --timeout=10s --start-period=30s --retries=5 \
CMD curl -f http://localhost:7777/ || exit 1

HEALTHCHECK --start-period=60s CMD ["node", "healthcheck.js"]
ENTRYPOINT ["./entry.sh"]

ENTRYPOINT ["./docker/entry.sh"]
10 changes: 0 additions & 10 deletions docker/healthcheck.js

This file was deleted.

8 changes: 8 additions & 0 deletions docker/saveconfig.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -o errexit

# Save git revision to config before removing .git folder
echo "Saving git revision to configuration..."
node gitrevupdate.js

echo "Git revision saved successfully!"
18 changes: 18 additions & 0 deletions gitrevupdate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env node

const config = require('./lib/config')
const gitRev = require('./lib/gitRevision')

console.log('Updating git revision in configuration...')

// Get the current git revision
const revision = gitRev()

if (revision) {
// Set the revision in the config
config.set('revision', revision)
console.log(`Git revision updated to: ${revision}`)
} else {
console.error('Failed to get git revision')
process.exit(1)
}
1 change: 0 additions & 1 deletion lib/config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

var fs = require('fs')
var extend = require('xtend')
var deepmerge = require('deepmerge')
Expand Down
14 changes: 13 additions & 1 deletion lib/sparql/sparql.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ function updateQuery (sparql, graphUri, accept) {
function updateQueryJson (sparql, graphUri) {
// const timer = Timer('sparql query')

return updateQuery(sparql, graphUri, 'application/sparql-results+json').then(parseResult)
return updateQuery(sparql, graphUri, 'application/sparql-results+json')
.then(parseResult)
.catch(handleError)

function parseResult (res) {
// timer()
Expand All @@ -71,6 +73,12 @@ function updateQueryJson (sparql, graphUri) {

return Promise.resolve(sparqlResultsToArray(results))
}

function handleError (error) {
console.error('SPARQL update query failed')
console.error(error.stack)
return Promise.reject(error)
}
}

function query (sparql, graphUri, accept, explorer = false) {
Expand Down Expand Up @@ -200,6 +208,10 @@ function deleteStaggered (sparql, graphUri) {
} else {
return performQuery()
}
}).catch((error) => {
Copy link

Copilot AI Jul 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Error handling for SPARQL operations is duplicated in both updateQueryJson and deleteStaggered. Consider extracting a shared error-logging helper to reduce duplication.

Copilot uses AI. Check for mistakes.
console.error('Delete operation failed')
console.error(error.stack)
return Promise.reject(error)
})
}
}
Expand Down
3 changes: 0 additions & 3 deletions synbiohub.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const db = require('./lib/db')
const fs = require('fs')
const jobUtils = require('./lib/jobs/job-utils')
const java = require('./lib/java')
const gitRev = require('./lib/gitRevision')
const logger = require('./lib/logger')
const theme = require('./lib/theme')

Expand All @@ -22,8 +21,6 @@ if (!fs.existsSync('synbiohub.sqlite') || fs.statSync('synbiohub.sqlite').size =
db.umzug.up().then(startServer)
}

config.set('revision', gitRev())

async function startServer () {
await java.init()
await theme.setCurrentThemeFromConfig()
Expand Down
Loading