From 4cc02d2e52ef095b4ed06e1624e322a0467a168e Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Thu, 20 Sep 2018 00:34:48 +0200 Subject: [PATCH] docker --- .dockerignore | 3 +++ Dockerfile | 11 +++++------ docker-compose.yml | 4 +++- package.json | 3 ++- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.dockerignore b/.dockerignore index 3c3629e..b0959cb 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,4 @@ node_modules +.git* +.cache +public diff --git a/Dockerfile b/Dockerfile index f148079..1aa99de 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,5 @@ FROM node:alpine -EXPOSE 8000 - RUN apk update && \ apk add --update --repository http://dl-3.alpinelinux.org/alpine/edge/testing \ vips-tools \ @@ -21,8 +19,9 @@ RUN apk update && \ RUN mkdir -p /portfolio WORKDIR /portfolio -VOLUME /portfolio -COPY ./scripts/entry.sh / -RUN chmod +x /entry.sh -ENTRYPOINT ["/entry.sh"] +COPY package.json . + +RUN npm install --quiet && npm cache clean --force + +#CMD [ "npm", "run", "dev" ] diff --git a/docker-compose.yml b/docker-compose.yml index 829f513..df6ffea 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,9 @@ version: '3' services: gatsby: build: . + command: npm run dev volumes: - .:/portfolio + - /portfolio/node_modules ports: - - "8000:8000" + - '8000:8000' diff --git a/package.json b/package.json index 591b88f..6057734 100644 --- a/package.json +++ b/package.json @@ -7,11 +7,12 @@ "license": "MIT", "author": "Matthias Kretschmann ", "scripts": { + "start": "npm run dev", "lint:js": "eslint ./gatsby-*.js && eslint ./src/**/*.{js,jsx}", "lint:css": "stylelint ./src/**/*.{css,scss}", "lint": "npm run svg && npm run lint:js && npm run lint:css", "build": "npm run svg && ./node_modules/gatsby/dist/bin/gatsby.js build", - "start": "npm run svg && ./node_modules/gatsby/dist/bin/gatsby.js develop", + "dev": "npm run svg && ./node_modules/gatsby/dist/bin/gatsby.js develop", "format": "prettier --write 'src/**/*.{js,jsx}'", "format:css": "prettier-stylelint --write --quiet 'src/**/*.{css,scss}'", "test": "npm run lint && ./node_modules/.bin/ava **/*.test.js --verbose",