Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ZEPPELIN-6122] Write a Dockerfile for java interpreter image build #4865 #4866

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
50 changes: 50 additions & 0 deletions java/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

FROM openjdk:11 as builder

COPY . /zeppelin/

WORKDIR /zeppelin

RUN chmod +x ./mvnw

RUN ./mvnw clean package -am -pl zeppelin-interpreter-shaded,zeppelin-interpreter,java -DskipTests


FROM openjdk:11

COPY --from=builder /zeppelin/bin /zeppelin/bin/
COPY --from=builder /zeppelin/conf /zeppelin/conf

COPY --from=builder /zeppelin/interpreter/java /zeppelin/interpreter/java
COPY --from=builder /zeppelin/zeppelin-interpreter-shaded/target /zeppelin/zeppelin-interpreter-shaded/target

WORKDIR /zeppelin

ENV JAVA_INTERPRETER_PORT=8085

RUN chmod +x ./bin/interpreter.sh

CMD ./bin/interpreter.sh \
-d ./interpreter/java \
-c host.docker.internal \
-p "${INTERPRETER_EVENT_SERVER_PORT}" \
-r "${JAVA_INTERPRETER_PORT}:${JAVA_INTERPRETER_PORT}" \
-i java-shared_process \
-l ./local-repo \
-g java
33 changes: 33 additions & 0 deletions java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,36 @@ Current interpreter implementation supports the static REPL. It compiles the cod
* If there is any error during compilation, it can catch and redirect to Zeppelin.

* `JavaInterpreterUtils` contains useful methods to print out Java collections and leverage Zeppelin's built in visualization.

## Run the interpreter with docker
You can run the java interpreter as a standalone docker container.

### Step 1. Specify the configuration for the interpreter
```bash
# conf/interpreter.json

"java": {
...
"option":
} {
"remote": true,
"port": {INTERPRETER_PROCESS_PORT_IN_HOST},
"isExistingProcess": true,
"host": "localhost",
...
}
````

### Step 2. Build and run the interpreter
```bash
zeppelin $ ./mvnw clean install -DskipTests

zeppelin $ ./bin/zeppelin-daemon.sh start # start zeppelin server.
# check the port of the interpreter event server. you can find it by looking for the log that starts with "InterpreterEventServer is starting at"

zeppelin $ docker build -f ./java/Dockerfile -t java-interpreter .

zeppelin $ docker run -p {INTERPRETER_PROCESS_PORT_IN_HOST}:8085 \
-e INTERPRETER_EVENT_SERVER_PORT={INTERPRETER_EVENT_SERVER_PORT} \
java-interpreter
```