diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fa5afa9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +# Build Stage 1 +# This build created a staging docker image +# +FROM node:10.15.2-alpine AS appbuild +WORKDIR /usr/src/app +COPY package.json ./ +RUN npm install +COPY . . +EXPOSE 3000 +CMD npm start \ No newline at end of file diff --git a/README.md b/README.md index dc6566b..9240e4d 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,21 @@ Access the page by going to localhost:3000 npm test ``` +### How to run the server in Docker / Docker-compose + +Build the container +``` +docker-compose build +``` + +Run the application in Docker. + +``` +docker-compose up -d +``` +The container will expose port 3000 + + --- ### How it works diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..95832df --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,26 @@ +version: '3' +services: + vynchronize: + #image: vynchronize + build: . + container_name: vynchronize + deploy: + replicas: 1 + restart_policy: + condition: any + environment: + - YT3_API_KEY + - DM_API_KEY + ports: + - 3000:3000 + healthcheck: + interval: 1m30s + retries: 3 + test: + - CMD + - curl + - -f + - http://localhost + timeout: 10s + +