From 189f44912a1becb64d792f176764181f2f380d12 Mon Sep 17 00:00:00 2001 From: acarra_ Date: Mon, 16 Jun 2025 16:24:29 +0200 Subject: [PATCH 1/6] change DSP_IFACE to 0.0.0.0 in order to make the server available in docker image --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index e85cb67..963e1da 100644 --- a/index.js +++ b/index.js @@ -28,7 +28,7 @@ const healthChecker = require('./app/util/HealthLabState.js'); const errorHandler = require('express-error-handler'); const port = +process.env.PORT || 18181; -const host = process.env.DSP_IFACE || "127.0.0.1"; +const host = process.env.DSP_IFACE || "0.0.0.0"; // var upload = multer({ dest: "uploads/" }); const storage = multer.memoryStorage(); const upload = multer({ storage }); From 2048f58a13fa2aa0c925507c873341904c981fa4 Mon Sep 17 00:00:00 2001 From: kali Date: Mon, 16 Jun 2025 17:08:06 +0200 Subject: [PATCH 2/6] setup the dockerfile and the docker-compose.yml file to create the image and build the project --- build/docker-compose.yml | 8 ++++++++ build/dockerfile | 26 ++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 build/docker-compose.yml create mode 100644 build/dockerfile diff --git a/build/docker-compose.yml b/build/docker-compose.yml new file mode 100644 index 0000000..9a67be5 --- /dev/null +++ b/build/docker-compose.yml @@ -0,0 +1,8 @@ +services: + dsp: + build: . + container_name: dsp-app + ports: + - "18181:18181" + volumes: + - /var/run/docker.sock:/var/run/docker.sock diff --git a/build/dockerfile b/build/dockerfile new file mode 100644 index 0000000..f6be2eb --- /dev/null +++ b/build/dockerfile @@ -0,0 +1,26 @@ +FROM node:22.16 + +# Install required packages +RUN apt-get update && apt-get install -y \ + python3 \ + python3-pip \ + git \ + docker.io \ + docker-compose \ + && rm -rf /var/lib/apt/lists/* + +# Clone the DSP repository +RUN git clone https://github.com/doomseur/DSP.git /opt/DSP + +WORKDIR /opt/DSP + +# Install backend dependencies +RUN npm install + + +# Expose DSP default port +EXPOSE 18181 + +# Start the DSP backend +CMD ["npm", "start"]() + From e859e188988384dc115f3defba9a9f3234924fc7 Mon Sep 17 00:00:00 2001 From: kali Date: Mon, 16 Jun 2025 17:09:30 +0200 Subject: [PATCH 3/6] remove the build to put it in a separate branch --- build/docker-compose.yml | 8 -------- build/dockerfile | 26 -------------------------- 2 files changed, 34 deletions(-) delete mode 100644 build/docker-compose.yml delete mode 100644 build/dockerfile diff --git a/build/docker-compose.yml b/build/docker-compose.yml deleted file mode 100644 index 9a67be5..0000000 --- a/build/docker-compose.yml +++ /dev/null @@ -1,8 +0,0 @@ -services: - dsp: - build: . - container_name: dsp-app - ports: - - "18181:18181" - volumes: - - /var/run/docker.sock:/var/run/docker.sock diff --git a/build/dockerfile b/build/dockerfile deleted file mode 100644 index f6be2eb..0000000 --- a/build/dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -FROM node:22.16 - -# Install required packages -RUN apt-get update && apt-get install -y \ - python3 \ - python3-pip \ - git \ - docker.io \ - docker-compose \ - && rm -rf /var/lib/apt/lists/* - -# Clone the DSP repository -RUN git clone https://github.com/doomseur/DSP.git /opt/DSP - -WORKDIR /opt/DSP - -# Install backend dependencies -RUN npm install - - -# Expose DSP default port -EXPOSE 18181 - -# Start the DSP backend -CMD ["npm", "start"]() - From 4fe52e3d547c78caf67004fbabf93c21719ef8f3 Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 18 Jun 2025 09:22:09 +0200 Subject: [PATCH 4/6] adding dockerfile to build the docker image and docker-compose.yml file --- docker-compose.yml | 8 ++++++++ dockerfile | 31 +++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 docker-compose.yml create mode 100644 dockerfile diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..9a67be5 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +services: + dsp: + build: . + container_name: dsp-app + ports: + - "18181:18181" + volumes: + - /var/run/docker.sock:/var/run/docker.sock diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..40d41f0 --- /dev/null +++ b/dockerfile @@ -0,0 +1,31 @@ +FROM node:22.16 + +# Install required packages +RUN apt-get update && apt-get install -y \ + python3 \ + python3-pip \ + git \ + docker.io \ + docker-compose \ + && rm -rf /var/lib/apt/lists/* + +# create the working directory +# RUN mkdir -p /opt/DSP + +# Copy the source in the DSP directory +COPY ./. opt/DSP + +# Clone the DSP repository +# RUN git clone https://github.com/DockerSecurityPlayground/DSP.git /opt/DSP + +WORKDIR /opt/DSP + +# Install backend dependencies +RUN npm install + + +# Expose DSP default port +EXPOSE 18181 + +# Start the DSP backend +CMD ["npm", "start"]() From 7b1af7c56352ccdb0fc116392a0c366d30219c09 Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 18 Jun 2025 09:24:53 +0200 Subject: [PATCH 5/6] update dockerfile --- dockerfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/dockerfile b/dockerfile index 40d41f0..aba1bf6 100644 --- a/dockerfile +++ b/dockerfile @@ -15,9 +15,6 @@ RUN apt-get update && apt-get install -y \ # Copy the source in the DSP directory COPY ./. opt/DSP -# Clone the DSP repository -# RUN git clone https://github.com/DockerSecurityPlayground/DSP.git /opt/DSP - WORKDIR /opt/DSP # Install backend dependencies From 067fb6927b1d81680605a1060f0dd4978aa7489f Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 18 Jun 2025 09:31:09 +0200 Subject: [PATCH 6/6] update the README file with docker compose instruction --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3a4707c..c6455ff 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,14 @@ Follow [DSP channel](https://www.youtube.com/channel/UCkmz_sagT7_kxSdmttDWg9A) t You can also use [wiki](https://github.com/giper45/DockerSecurityPlayground/wiki) documentation to understand how you can use DSP. Follow Installation and Start steps to run DSP. +# Running it in a docker container + +```sh +docker compose up +``` +access it with your local ip (localhost:18181) + +## How it works The package: * Install docker and docker-compose @@ -73,7 +81,6 @@ Now you can use dsp on Remote interface. - ## Update the application: When you update the application it is important to update the npm packages (The application uses mydockerjs, a npm docker API that I am developing during DSP development: https://www.npmjs.com/package/mydockerjs) ```