1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-12-23 01:30:01 +01:00

add Docker for local development

This commit is contained in:
Matthias Kretschmann 2019-10-17 18:23:16 +02:00
parent 9197962a77
commit 2988e1b44a
Signed by: m
GPG Key ID: 606EEEF3C479A91F
6 changed files with 61 additions and 9 deletions

16
.dockerignore Normal file
View File

@ -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

View File

@ -1,7 +1,6 @@
dist: xenial dist: xenial
language: node_js language: node_js
node_js: node_js: node
- '12'
git: git:
depth: 10 depth: 10

25
Dockerfile Normal file
View File

@ -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

View File

@ -163,20 +163,21 @@ If you want to know how this works, have a look at the respective component unde
## ✨ Development ## ✨ Development
You need to have the following tools installed on your development machine before moving on: 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.
- [Node.js](http://nodejs.org/)
- [npm](https://npmjs.org/)
Then install dependencies and start everything up:
```bash ```bash
npm i git clone git@github.com:kremalicious/blog.git
cd blog/
# GITHUB_TOKEN is required for some parts # GITHUB_TOKEN is required for some parts
cp .env.sample .env cp .env.sample .env
vi .env vi .env
# use Docker
docker-compose up
# or go with local system
npm i
npm start npm start
``` ```

10
docker-compose.yml Normal file
View File

@ -0,0 +1,10 @@
version: '3'
services:
blog:
build: .
command: npm run start:docker
volumes:
- .:/blog
- /blog/node_modules
ports:
- '8000:8000'

View File

@ -8,6 +8,7 @@
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"start": "gatsby develop", "start": "gatsby develop",
"start:docker": "gatsby develop --host 0.0.0.0",
"build": "gatsby build && npm run copy", "build": "gatsby build && npm run copy",
"ssr": "npm run build && serve -s public/", "ssr": "npm run build && serve -s public/",
"test": "npm run lint && jest --coverage", "test": "npm run lint && jest --coverage",