File size: 1,647 Bytes
fe66731
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
###########
# WebVOWL #
###########

# Stage 1: Build OWL2VOWL converter from source
FROM docker.io/maven:3-openjdk-8-slim AS owl2vowl-builder

WORKDIR /owl2vowl

# Clone and build OWL2VOWL WAR
RUN apt-get update && \
    apt-get install -y git && \
    git clone https://github.com/VisualDataWeb/OWL2VOWL.git . && \
    mvn clean package -P war-release -DskipTests

# Stage 2: Build WebVOWL from source
FROM docker.io/node:12-alpine AS webvowl-builder

WORKDIR /build

# Copy package files
COPY package.json ./
COPY Gruntfile.js ./
COPY webpack.config.js ./

# Copy source code and configuration
COPY src ./src
COPY util ./util
COPY .jshintrc ./.jshintrc
COPY .jshintignore ./.jshintignore

# Install dependencies and build
RUN npm install && \
    npm run release

# Stage 3: Runtime - Deploy both to Tomcat
FROM docker.io/tomcat:9-jdk8-openjdk-slim

# Remove default webapps
RUN rm -rf /usr/local/tomcat/webapps/*

# First, deploy OWL2VOWL WAR as ROOT (this provides the servlets)
RUN mkdir -p /usr/local/tomcat/webapps/ROOT
COPY --from=owl2vowl-builder /owl2vowl/target/*.war /tmp/owl2vowl.war
RUN cd /usr/local/tomcat/webapps/ROOT && \
    jar -xf /tmp/owl2vowl.war && \
    rm /tmp/owl2vowl.war

# Then, copy WebVOWL static files into the same ROOT context
# This merges the static frontend with the backend servlets
COPY --from=webvowl-builder /build/deploy /usr/local/tomcat/webapps/ROOT/

# Expose port 7860 (Hugging Face Spaces standard port)
EXPOSE 7860

# Configure Tomcat to listen on port 7860 instead of default 8080
RUN sed -i 's/port="8080"/port="7860"/g' /usr/local/tomcat/conf/server.xml

# Run Tomcat
CMD ["catalina.sh", "run"]