Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
target
.git
.idea
*.iml
14 changes: 13 additions & 1 deletion backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# ---------- Build stage ----------
FROM maven:3.9-eclipse-temurin-25 AS builder

WORKDIR /app

COPY pom.xml .
RUN mvn dependency:go-offline

COPY src ./src
RUN mvn clean package -DskipTests

# ---------- Runtime stage ----------
FROM eclipse-temurin:25.0.2_10-jre

ARG APP_VERSION=""
Expand All @@ -8,7 +20,7 @@ WORKDIR /app

RUN groupadd -r appuser && useradd -r -g appuser appuser

COPY target/*.jar app.jar
COPY --from=builder /app/target/*.jar app.jar

RUN chown -R appuser:appuser /app

Expand Down
8 changes: 7 additions & 1 deletion backend/src/main/java/org/rdfarchitect/config/WebConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,16 @@
@Configuration
public class WebConfig implements WebMvcConfigurer {

private final FrontendConfig frontendConfig;

public WebConfig(FrontendConfig frontendConfig) {
this.frontendConfig = frontendConfig;
}

@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/api/**")
.allowedOrigins("http://localhost:1407")
.allowedOrigins(frontendConfig.getUrl())
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH", "HEAD")
.allowedHeaders("*")
.allowCredentials(true)
Expand Down
8 changes: 5 additions & 3 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
services:
backend:
build:
context: ./backend
context: ../backend
environment:
DATABASE_DATABASETYPE: http
DATABASE_DEFAULTDATASET: default
DATABASE_HTTP_ENDPOINT: http://host.docker.internal:3030
FRONTEND_URL: http://localhost:3000
FRONTEND_ACCESS_ROUTE: /api
expose:
- "8080"

frontend:
build:
context: ./frontend
context: ../frontend
environment:
PUBLIC_BACKEND_URL: "/api"
expose:
Expand All @@ -28,4 +30,4 @@ services:
- ./nginx.local.conf:/etc/nginx/conf.d/default.conf:ro

volumes:
fuseki-data:
fuseki-data:
4 changes: 4 additions & 0 deletions frontend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
build
dist
.git
19 changes: 18 additions & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# ---------- Build stage ----------
FROM node:22-alpine AS builder

WORKDIR /app

# Copy package files first for better layer caching
COPY package*.json ./

RUN npm ci

# Copy source code
COPY . .

# Build frontend
RUN npm run build

# ---------- Runtime stage ----------
FROM nginx:alpine3.22

ARG PUBLIC_APP_VERSION=""
Expand All @@ -10,7 +27,7 @@ ENV PUBLIC_APP_VERSION="${PUBLIC_APP_VERSION}" \

#RUN addgroup -S appgroup && adduser -S appuser -G appgroup

COPY build /usr/share/nginx/html
COPY --from=builder /app/build /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY docker-entrypoint.sh /docker-entrypoint.sh

Expand Down