diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..edd83c0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +node_modules +npm-debug.log +Dockerfile +.dockerignore \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..31b4a65 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM node:12 + +RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app + +WORKDIR /home/node/app + +COPY package*.json ./ + +USER node + +RUN npm install + +COPY --chown=node:node . . + +EXPOSE 6006 + +# CMD [ "node", "app.js" ] +ENTRYPOINT /bin/bash \ No newline at end of file diff --git a/README.md b/README.md index 30602a2..6b276d2 100644 --- a/README.md +++ b/README.md @@ -1 +1,19 @@ -# sakai-web-components \ No newline at end of file +# sakai-web-components + +## Setup with Docker + +Run the following commands to get up and running if you have Docker and Docker Compose installed. + +` docker-compose run --rm --service-ports node` + +Your CLI will then be in the container and your prompt should change to something like `node@asdf123:~/app$` + +You can then run these commands from inside the container + +`npm install` + +`npm run storybook` + +You should be able to visit [http://localhost:6006](http://localhost:6006) and see the storybook interface. + +ctrl+c will end the storybook server and typing `exit` will return you to your normal CLI prompt. \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..0723296 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +version: "3" +services: + node: + build: . + container_name: sakai-web-components + # user: "node" + # working_dir: /home/node/app + # environment: + # - NODE_ENV=production + # - NPM_CONFIG_LOGLEVEL=info + volumes: + - ./:/home/node/app + ports: + - 6006:6006 \ No newline at end of file