diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..7b49a069 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,16 @@ +node_modules +npm-debug.log +Dockerfile* +docker-compose* +.dockerignore +.git +.gitignore +README.md +LICENSE +.vscode +public +.cache +.travis.yml +package-lock.json +README.md +coverage diff --git a/.travis.yml b/.travis.yml index 11d4cf34..cf0da495 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ dist: xenial language: node_js -node_js: - - '12' +node_js: node git: depth: 10 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..2dba9d1b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +# Dockerfile for local development just installing dependencies. +# Use together with `docker-compose up` +FROM node:alpine + +RUN mkdir -p /blog +WORKDIR /blog +COPY package.json . + +RUN apk add --no-cache --virtual .build-deps \ + g++ \ + make \ + autoconf \ + automake \ + libtool \ + nasm \ + libc6-compat \ + libjpeg-turbo-dev \ + libpng-dev \ + git \ + bash \ + python \ + && rm -rf /var/cache/apk/* \ + && npm install \ + && npm cache clean --force \ + && apk del .build-deps diff --git a/README.md b/README.md index 53c917c8..f36922b9 100644 --- a/README.md +++ b/README.md @@ -163,20 +163,21 @@ If you want to know how this works, have a look at the respective component unde ## ✨ Development -You need to have the following tools installed on your development machine before moving on: - -- [Node.js](http://nodejs.org/) -- [npm](https://npmjs.org/) - -Then install dependencies and start everything up: +You can simply use [Docker](https://www.docker.com) & [Docker Compose](https://docs.docker.com/compose/) or install and run dependencies on your local system. ```bash -npm i +git clone git@github.com:kremalicious/blog.git +cd blog/ # GITHUB_TOKEN is required for some parts cp .env.sample .env vi .env +# use Docker +docker-compose up + +# or go with local system +npm i npm start ``` diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..98e22bd9 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +version: '3' +services: + blog: + build: . + command: npm run start:docker + volumes: + - .:/blog + - /blog/node_modules + ports: + - '8000:8000' diff --git a/package.json b/package.json index 11fbc887..91b2f3f5 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "main": "index.js", "scripts": { "start": "gatsby develop", + "start:docker": "gatsby develop --host 0.0.0.0", "build": "gatsby build && npm run copy", "ssr": "npm run build && serve -s public/", "test": "npm run lint && jest --coverage",