diff --git a/Dockerfile b/Dockerfile index f454d26..1bb9fbb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,20 +10,18 @@ RUN apt-get update && \ # Install yarn globally RUN npm install -g yarn -# Clone the repository -RUN git clone https://github.com/hppanpaliya/React-TrashMail +# Install pm2 globally +RUN npm install -g pm2 -# Install dependencies for the React project +# Copy in package.json files and run install to allow docker to cache themc +COPY react/package.json /React-TrashMail/react/ WORKDIR /React-TrashMail/react RUN yarn - - -# Install dependencies for the mailserver +COPY mailserver/package.json /React-TrashMail/mailserver/ WORKDIR /React-TrashMail/mailserver RUN yarn -# Install pm2 globally -RUN npm install -g pm2 +COPY . /React-TrashMail # Define mountable volume VOLUME ["/React-TrashMail/mailserver/attachments"] diff --git a/docker_start.sh b/docker_start.sh index 267cb88..499af46 100644 --- a/docker_start.sh +++ b/docker_start.sh @@ -25,4 +25,4 @@ fi # Start the application cd /React-TrashMail/mailserver -pm2-runtime start yarn -- start +PM2_HOME=/React-Trashmail/mailserver pm2-runtime start yarn -- start:docker diff --git a/mailserver/package.json b/mailserver/package.json index 6f916b5..13ae4fc 100644 --- a/mailserver/package.json +++ b/mailserver/package.json @@ -5,6 +5,7 @@ "main": "index.js", "scripts": { "start": "nodemon server.js", + "start:docker": "node server.js", "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [],