diff --git a/README.md b/README.md index 2099e9c..b583088 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 @@ -75,7 +83,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) ``` 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..aba1bf6 --- /dev/null +++ b/dockerfile @@ -0,0 +1,28 @@ +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 + +WORKDIR /opt/DSP + +# Install backend dependencies +RUN npm install + + +# Expose DSP default port +EXPOSE 18181 + +# Start the DSP backend +CMD ["npm", "start"]() 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 });