Skip to content

Commit

Permalink
Updated the CPLEX as independent base image
Browse files Browse the repository at this point in the history
  • Loading branch information
victorskl committed Jul 4, 2018
1 parent 16a7ce3 commit e993f3c
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 10 deletions.
7 changes: 1 addition & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
FROM openjdk:8-jre
FROM cplex:12.8

COPY cplex_studio128.linux-x86-64.bin /app/cplex_studio128.linux-x86-64.bin
COPY response.properties /app/response.properties
COPY src/ /app/

WORKDIR /app

RUN chmod u+x cplex_studio128.linux-x86-64.bin
RUN ./cplex_studio128.linux-x86-64.bin -f response.properties

ENTRYPOINT ["java","-Djava.library.path=/opt/ibm/ILOG/CPLEX_Studio128/cplex/bin/x86-64_linux","-cp",".:/opt/ibm/ILOG/CPLEX_Studio128/cplex/lib/cplex.jar","HelloCplex"]
39 changes: 35 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# docker-cplex

IBM ILOG CPLEX deployment with Docker. The [demo Java code](src/HelloCplex.java) to use the CPLEX through Concert API Technology. This will end up the embedding use on CPLEX runtime component.
IBM ILOG CPLEX deployment with Docker. The [demo Java code](src/HelloCplex.java) to use the CPLEX through [Concert API Technology](https://www.ibm.com/support/knowledgecenter/en/SSSA5P_12.8.0/ilog.odms.cplex.help/CPLEX/UsrMan/topics/APIs/Java/06_modeling_title_synopsis.html). This will end up the embedding use on CPLEX runtime component.

### On Local Development

Expand Down Expand Up @@ -47,9 +47,41 @@ Dual of cons03: 0.0014999999999999996

### On Docker Deployment

- In [`Dockerfile`](Dockerfile), we will be using [JRE-8](https://hub.docker.com/_/openjdk/) __ONLY__.
#### Build CPLEX JRE Docker Image

- The container image will be Debian base; therefore copy the downloaded CPLEX Linux installer `cplex_studio128.linux-x86-64.bin` to the same location with `Dockerfile`.
- The docker container image will be Debian based [openjdk:8-jre](https://hub.docker.com/_/openjdk/).

- Copy the downloaded CPLEX Linux installer `cplex_studio128.linux-x86-64.bin` to the same location with `cplex/Dockerfile`.

```
tree cplex
cplex
├── Dockerfile
├── cplex_studio128.linux-x86-64.bin
└── response.properties
```

- Build the image:

```
cd cplex
docker image build -t cplex:12.8 -t cplex:12.8.0 .
docker images|grep cplex
cplex 12.8 3b473e7d9ec3 About a minute ago 3.43GB
cplex 12.8.0 3b473e7d9ec3 About a minute ago 3.43GB
```

- _(Optional)_ Publish to private docker image registry:

```
docker tag cplex:12.8 docker-image-registry.com/namespace/cplex:12.8
docker tag cplex:12.8.0 docker-image-registry.com/namespace/cplex:12.8.0
docker push docker-image-registry.com/namespace/cplex:12.8
docker push docker-image-registry.com/namespace/cplex:12.8.0
```

#### Build Sample Java App

- Make sure to compile the `HelloCplex.java`. This is on macOS. Otherwise adjust the classpath.
```
Expand Down Expand Up @@ -97,4 +129,3 @@ Dual of cons03: 0.0014999999999999996
docker rmi dev_tusk
```
- EoF
8 changes: 8 additions & 0 deletions cplex/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM openjdk:8-jre

COPY cplex_studio128.linux-x86-64.bin /cplex/cplex_studio128.linux-x86-64.bin
COPY response.properties /cplex/response.properties

RUN chmod u+x /cplex/cplex_studio128.linux-x86-64.bin
RUN /cplex/cplex_studio128.linux-x86-64.bin -f /cplex/response.properties
RUN rm -rf /cplex
File renamed without changes.

0 comments on commit e993f3c

Please sign in to comment.