From 71fb6cef5e2597c4decc8ce7df4a773f74774aeb Mon Sep 17 00:00:00 2001 From: Kirill Kravinsky Date: Thu, 3 Nov 2016 17:38:05 -0400 Subject: [PATCH] Dockerizing Parse Server (#3005) * Add Dockerfile * Add Docker image docs * Remove default PARSE_SERVER_CLOUD_CODE_MAIN setting + update docs * Update docs * Update documentation --- .dockerignore | 21 +++++++++++++++++++++ Dockerfile | 21 +++++++++++++++++++++ README.md | 10 +++++++++- 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..c4eac56a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,21 @@ +node_modules +npm-debug.log +*.md +PATENTS +LICENSE +Dockerfile +.dockerignore +.gitignore +.travis.yml +.istanbul.yml +.git +.github + +# Build folder +lib/ + +# Tests +spec/ + +# IDEs +.idea/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..bf30a303 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM node:boron + +RUN mkdir -p /parse-server +COPY ./ /parse-server/ + +RUN mkdir -p /parse-server/config +VOLUME /parse-server/config + +RUN mkdir -p /parse-server/cloud +VOLUME /parse-server/cloud + +WORKDIR /parse-server + +RUN npm install && \ + npm run build + +ENV PORT=1337 + +EXPOSE $PORT + +ENTRYPOINT ["npm", "start", "--"] diff --git a/README.md b/README.md index e0ad1d19..799ef064 100644 --- a/README.md +++ b/README.md @@ -16,14 +16,22 @@ April 2016 - We created a series of video screencasts, please check them out her The fastest and easiest way to get started is to run MongoDB and Parse Server locally. -## Running Parse Server locally +## Running Parse Server +### Locally ``` $ npm install -g parse-server mongodb-runner $ mongodb-runner start $ parse-server --appId APPLICATION_ID --masterKey MASTER_KEY --databaseURI mongodb://localhost/test ``` +### Inside a Docker container +``` +$ docker build --tag my-parse-server . +$ docker run --name my-mongo -d mongo +$ docker run --name my-parse-server --link my-mongo:mongo parse-server --appId APPLICATION_ID --masterKey MASTER_KEY --databaseURI mongodb://mongo/test +``` + You can use any arbitrary string as your application id and master key. These will be used by your clients to authenticate with the Parse Server. That's it! You are now running a standalone version of Parse Server on your machine.