Skip to content

Commit

Permalink
docker: update main docker file to use multistage build
Browse files Browse the repository at this point in the history
We can do away with the build / dist files
  • Loading branch information
esatterwhite committed Jul 3, 2017
1 parent d3e98a8 commit 0f2e706
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 29 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ npm-debug.log
payload.txt
coverage/
tutorials/
*.tgz
20 changes: 17 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
FROM mhart/alpine-node:7
# -- NODE 8
FROM mhart/alpine-node:8 AS base
ENV storage__path /var/data/skyring
ENV NODE_ENV=development
COPY . /opt/skyring
ENV NODE_ENV=production

# -- BUILD
FROM base AS build

COPY package*.json /opt/skyring/
WORKDIR /opt/skyring

RUN apk update && \
apk upgrade && \
mkdir -p /var/data/skyring && \
apk add python make g++ git && \
npm install

RUN mv node_modules prod_node_modules

FROM base AS skyring
RUN mkdir -p /var/data/skyring
WORKDIR /opt/skyring
VOLUME /etc
VOLUME /var/data/skyring

COPY --from=build /opt/skyring/prod_node_modules ./node_modules
COPY . .
CMD ["node", "index.js"]
12 changes: 0 additions & 12 deletions Dockerfile.build

This file was deleted.

8 changes: 0 additions & 8 deletions Dockerfile.dist

This file was deleted.

6 changes: 3 additions & 3 deletions lib/server/api/post_timer.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module.exports = {
* "method": "put",
* "uri": "http://mydomain.name/timer/callback",
* "tranport":"http"
* }
* }
* @apiExample {curl} curl:
* curl -XPOST -H "Content-Type: application/json" http://localhost:3000/timer -d '{
* "timeout": 3000,
Expand Down Expand Up @@ -113,8 +113,8 @@ module.exports = {
*
* uri = URI.parse('http://localhost:3003/timer')
* payload = {
* timeout: 3000,
* data: "hello world",
* timeout: 3000,
* data: "hello world",
* callback: {
* method: 'post',
* transport: 'http',
Expand Down
4 changes: 2 additions & 2 deletions lib/server/api/put_timer.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ module.exports = {
*
* uri = URI.parse('http://localhost:3003/timer/8c66a779-9c74-4e30-b5e8-f32d60909d45')
* payload = {
* timeout: 3000,
* data: "hello world",
* timeout: 3000,
* data: "hello world",
* callback: {
* method: 'post',
* transport: 'http',
Expand Down
2 changes: 1 addition & 1 deletion lib/timer.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const options = {
, data: "this is a payload"
, callback: {
transport: 'http'
, method: 'put
, method: 'put'
, uri: 'http://api.domain.com/callback'
}
}
Expand Down

0 comments on commit 0f2e706

Please sign in to comment.