Vert.x - Docker

1 - About

Docker as a distribution unit to distribute an run a vert.x application

3 - Type

3.1 - Bare

Example:


docker run \
   --name "vertx" \
   -it \
   --rm \ 
   -p 8081:8080 \
   -v $PWD/build/libs:/app \
   anapsix/alpine-java \ 
   java -jar vertx-application-fat.jar

where:

3.2 - Vertx

3.2.1 - Create your image

From the base image vertx3

Example of Dockerfile for java:


# Extend vert.x image
FROM vertx/vertx3

#                                                       
ENV VERTICLE_NAME io.vertx.sample.hello.HelloVerticle
ENV VERTICLE_FILE target/hello-verticle-1.0-SNAPSHOT.jar

# Set the location of the verticles
ENV VERTICLE_HOME /usr/verticles

EXPOSE 8080

# Copy your verticle to the container
COPY $VERTICLE_FILE $VERTICLE_HOME/

# Launch the verticle
WORKDIR $VERTICLE_HOME
ENTRYPOINT ["sh", "-c"]
CMD ["exec vertx run $VERTICLE_NAME -cp $VERTICLE_HOME/*"]

3.2.2 - Run

Exec a verticle with the vertx3-exec image

It will start the run command


docker run -i -t -p 8080:8080 \ 
    -v $PWD:/verticles vertx/vertx3-exec \  
    run io.vertx.sample.RandomGeneratorVerticle \ 
    -cp /verticles/MY_VERTICLE.jar 


Data Science
Data Analysis
Statistics
Data Science
Linear Algebra Mathematics
Trigonometry

Powered by ComboStrap