Skip to content
Draft
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
21 changes: 19 additions & 2 deletions ojp-server/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
## Docker Image

### Build docker image locally
The base image is a custom Alpine JRE built with `jlink` (only the modules required by OJP), bringing the final image size to **128MB**.

> mvn compile jib:dockerBuild
### Build the base image (first time or when dependencies change)

```bash
# From the repository root
docker build -f ojp-server/base.Dockerfile -t rrobetti/ojp-base:jre24-alpine .
```

### Build the app image locally

```bash
mvn -pl ojp-server/ jib:dockerBuild -Djib.from.image=docker://rrobetti/ojp-base:jre24-alpine
```

### Run locally

```bash
docker run -p 1059:1059 rrobetti/ojp:0.4.9-SNAPSHOT
```

### Build and push to Docker Hub
PS: Only authorized users.
Expand Down
14 changes: 14 additions & 0 deletions ojp-server/base.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM eclipse-temurin:24-jdk-alpine AS jre-build

RUN jlink \
--add-modules java.base,java.compiler,java.desktop,java.management,java.naming,java.rmi,java.scripting,java.security.jgss,java.sql,jdk.httpserver,jdk.unsupported \
--strip-debug \
--no-man-pages \
--no-header-files \
--compress=zip-6 \
--output /custom-jre

FROM alpine:3.21
ENV JAVA_HOME=/opt/java
ENV PATH="${JAVA_HOME}/bin:${PATH}"
COPY --from=jre-build /custom-jre $JAVA_HOME