Skip to content
Snippets Groups Projects
Commit f46f8141 authored by KIEU Thi phuong's avatar KIEU Thi phuong
Browse files

Update file README.md

parent e56cb539
No related branches found
No related tags found
No related merge requests found
...@@ -95,37 +95,38 @@ DCLI is a tool which will help you manage DevContainers (https://gitlab.lis-lab. ...@@ -95,37 +95,38 @@ DCLI is a tool which will help you manage DevContainers (https://gitlab.lis-lab.
dcli --version dcli --version
``` ```
### Import Java Project ### Create Java project and Write dockerfile
Open Eclipse, create your own project or import the devs-dclitest project [here](https://gitlab.lis-lab.fr/thi-phuong.kieu/devs-dclitest/-/blob/main/devs-dclitest.zip). - **hello-world**
- **src**
- **main.java**
### Write Dockerfile script ```java
public class main {
Create and file named *Dockerfile* under the project folder, and insert this script: public static void main(String[] arg) {
System.out.println("Hello, World!");
}
}
```
- **dockerfile**
```javascript ```javascript
FROM openjdk:17 FROM openjdk
COPY src/ /devs-dclitest/src/ COPY src hello-world/src
COPY lib/ /devs-dclitest/lib/ WORKDIR hello-world
COPY input/ /devs-dclitest/input/ RUN mkdir -p bin
COPY output/ /devs-dclitest/output/ RUN javac -d bin ./main.java
WORKDIR /devs-dclitest WORKDIR bin
RUN mkdir -p /devs-dclitest/bin CMD ["java", "main.java"]
RUN javac -cp "/devs-dclitest/lib/fwkdevs-v0.7" -d /devs-dclitest/bin /devs-dclitest/src/*.java
CMD ["java", "-cp", "/devs-dclitest/bin:/devs-dclitest/lib/fwkdevs-v0.7", "Simulator"]
``` ```
*This scripts should have the exact name as `Dockerfile` or `dockerfile`.*
### Create docker image ### Create docker image
Then build and run docker by command line:
```bash ```bash
docker build -t devs-dcli:test . docker build -t hello:test .
``` ```
```bash ```bash
docker run -it devs-dcli:test docker run -it hello:test
``` ```
### Initialize a project using a customized Devcontainer configuration ### Initialize a project using a customized Devcontainer configuration
...@@ -139,7 +140,7 @@ dcli init ...@@ -139,7 +140,7 @@ dcli init
Insert image name of docker created: Insert image name of docker created:
```bash ```bash
Image Name: devs-dcli:test Image Name: hello:test
``` ```
### Test running the DevContainer ### Test running the DevContainer
...@@ -153,7 +154,7 @@ dcli start ...@@ -153,7 +154,7 @@ dcli start
You will see the VSCode workspace opened. Test running the java program inside the DevContainer, type: You will see the VSCode workspace opened. Test running the java program inside the DevContainer, type:
```bash ```bash
java -cp /devs-dclitest/bin:/devs-dclitest/lib/fwkdevs-v0.7 Simulator java main.java
``` ```
Stop the container: Stop the container:
...@@ -192,7 +193,7 @@ Then create new folders: ...@@ -192,7 +193,7 @@ Then create new folders:
```bash ```bash
mkdir devcontainer_images # for the squashfs file mkdir devcontainer_images # for the squashfs file
mkdir devs-dclitest # for your soucre code mkdir hello-world # for your soucre code
``` ```
On the second window, type: On the second window, type:
...@@ -206,7 +207,7 @@ Please provide the following information to create the .cluster_config file. ...@@ -206,7 +207,7 @@ Please provide the following information to create the .cluster_config file.
Cluster server name/address [sms]: sms Cluster server name/address [sms]: sms
LIS cluster username []: your-user.name LIS cluster username []: your-user.name
Devcontainer workspace directory path [/workspace]: /workspace Devcontainer workspace directory path [/workspace]: /workspace
Project directory (absolute path) to mount inside the devcontainer located on the cluster []: /home/your-user.name/devs-dclitest/ Project directory (absolute path) to mount inside the devcontainer located on the cluster []: /home/your-user.name/hello-world/
Directory containing squashfs images (absolute path) located on the cluster []: /home/your-user.name/devcontainer_images/ Directory containing squashfs images (absolute path) located on the cluster []: /home/your-user.name/devcontainer_images/
.cluster_config file created successfully in the .devcontainer directory. .cluster_config file created successfully in the .devcontainer directory.
...@@ -222,7 +223,7 @@ dcli push ...@@ -222,7 +223,7 @@ dcli push
Then, push your source code to the cluster. E.g: Then, push your source code to the cluster. E.g:
```bash ```bash
scp -r -o ProxyJump="your-user.name@139.124.22.4" ./src/Car.java your-user.name@sms:/home/your-user.name/devs-dclitest/src/Car.java scp -r -o ProxyJump="your-user.name@139.124.22.4" ./src/main.java your-user.name@sms:/home/your-user.name/hello-world/src/main.java
``` ```
### Run your DevContainer on LIS Cluster ### Run your DevContainer on LIS Cluster
...@@ -236,11 +237,11 @@ dcli irun ...@@ -236,11 +237,11 @@ dcli irun
Once connect successfully, type: Once connect successfully, type:
```bash ```bash
java -cp /devs-dclitest/bin:/devs-dclitest/lib/fwkdevs-v0.7 Simulator java main.java
``` ```
**Note:** To run manually, connect to the cluster first, then type: **Note:** To run manually, connect to the cluster first, then type:
```bash ```bash
srun --container-image=/home/your-user.name/devcontainer_images//dcli_devs-dclitest.squashfs --container-mounts=/home/your-user.name/devs-dclitest/:/workspace --container-workdir=/workspace --cpus-per-task=12 --pty bash srun --container-image=/home/your-user.name/devcontainer_images//dcli_hello-world.squashfs --container-mounts=/home/your-user.name/hello-world/:/workspace --container-workdir=/workspace --cpus-per-task=12 --pty bash
``` ```
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment