Skip to content

Commit 6ca386c

Browse files
committed
feat: containerize setup with docker-compose and support HOST environment variable
1 parent 1797115 commit 6ca386c

8 files changed

Lines changed: 9293 additions & 1273 deletions

File tree

.dockerignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.git
2+
node_modules
3+
**/node_modules
4+
dist
5+
**/dist
6+
.DS_Store
7+
.vscode
8+
.claude
9+
coverage
10+
run

Dockerfile

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Stage 1: Build
2+
FROM node:22-slim AS builder
3+
4+
WORKDIR /usr/src/app
5+
6+
# Copy package files for workspaces dependency resolution
7+
COPY package*.json ./
8+
COPY storage-service/package*.json ./storage-service/
9+
COPY jena-storage-service/package*.json ./jena-storage-service/
10+
COPY ldp-service/package*.json ./ldp-service/
11+
COPY oslc-service/package*.json ./oslc-service/
12+
COPY oslc-client/package*.json ./oslc-client/
13+
COPY oslc-browser/package*.json ./oslc-browser/
14+
COPY bmm-server/package*.json ./bmm-server/
15+
COPY bmm-server/ui/package*.json ./bmm-server/ui/
16+
17+
# Install workspaces dependencies
18+
RUN npm install
19+
20+
# Copy the entire monorepo source code
21+
COPY . .
22+
23+
# Build workspaces in dependency order
24+
RUN npm run build --workspace=storage-service && \
25+
npm run build --workspace=jena-storage-service && \
26+
npm run build --workspace=ldp-service && \
27+
npm run build --workspace=oslc-service && \
28+
npm run build --workspace=oslc-browser && \
29+
npm run build --workspace=bmm-server
30+
31+
# Build the BMM Web UI assets
32+
WORKDIR /usr/src/app/bmm-server/ui
33+
RUN npm install && npm run build
34+
35+
# Stage 2: Runtime
36+
FROM node:22-slim
37+
38+
# Install curl (required for startup checks and population script)
39+
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
40+
41+
WORKDIR /usr/src/app
42+
43+
# Copy built workspace and node_modules from builder
44+
COPY --from=builder /usr/src/app /usr/src/app
45+
46+
EXPOSE 3005
47+
48+
WORKDIR /usr/src/app/bmm-server
49+
RUN chmod +x start.sh testing/populate-eurent.sh
50+
51+
CMD ["./start.sh"]

create-oslc-server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ export interface AppEnv extends StorageEnv {
776776
templatePath?: string;
777777
}
778778
779-
const listenHost = process.env.VCAP_APP_HOST || process.env.OPENSHIFT_NODEJS_IP || config.host;
779+
const listenHost = process.env.HOST || process.env.VCAP_APP_HOST || process.env.OPENSHIFT_NODEJS_IP || config.host;
780780
const listenPort = Number(process.env.VCAP_APP_PORT || process.env.OPENSHIFT_NODEJS_PORT || config.port);
781781
782782
let scheme: string;

docker-compose.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
services:
2+
fuseki:
3+
image: stain/jena-fuseki:latest
4+
container_name: fuseki
5+
ports:
6+
- "127.0.0.1:3030:3030"
7+
- "[::1]:3030:3030"
8+
environment:
9+
- ADMIN_PASSWORD=admin
10+
volumes:
11+
- ../fuseki:/fuseki
12+
restart: unless-stopped
13+
14+
bmm-server:
15+
build:
16+
context: .
17+
dockerfile: Dockerfile
18+
container_name: bmm-server
19+
ports:
20+
- "127.0.0.1:3005:3005"
21+
- "[::1]:3005:3005"
22+
environment:
23+
- JENA_URL=http://fuseki:3030/bmm/
24+
- HOST=0.0.0.0
25+
depends_on:
26+
- fuseki
27+
restart: unless-stopped

mrm-server/src/env.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export interface AppEnv extends StorageEnv {
5656
templatePath?: string;
5757
}
5858

59-
const listenHost = process.env.VCAP_APP_HOST || process.env.OPENSHIFT_NODEJS_IP || config.host;
59+
const listenHost = process.env.HOST || process.env.VCAP_APP_HOST || process.env.OPENSHIFT_NODEJS_IP || config.host;
6060
const listenPort = Number(process.env.VCAP_APP_PORT || process.env.OPENSHIFT_NODEJS_PORT || config.port);
6161

6262
let scheme: string;

oslc-browser/src/hooks/useOslcClient.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,8 +634,9 @@ async function fetchSameServerIncomingLinks(
634634
export function useOslcClient(): UseOslcClientReturn {
635635
const [connection, setConnection] = useState<ConnectionState>(() => {
636636
const saved = loadSavedConnection();
637+
const defaultURL = typeof window !== 'undefined' ? `${window.location.origin}/oslc` : '';
637638
return {
638-
serverURL: saved.serverURL ?? '',
639+
serverURL: saved.serverURL ?? defaultURL,
639640
username: saved.username ?? '',
640641
password: '',
641642
connected: false,

0 commit comments

Comments
 (0)