diff --git a/README.md b/README.md index a289fd4..1784f7c 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,13 @@ | `npm run clean` | Remove the `node_modules` directory from all packages | | `npm run generate` | Generate example honeycomb services (`packages/example-*`) | +### Docker + +| Command | Description | +| --------|-------------| +| `npm run docker:build` | Build the dist version for `packages/honeycomb-layout` and `packages/example-*` | +| `docker-compose up` | Create and start containers | + ## License Copyright (c) 2016 Daniel Bayerlein. See [LICENSE](./LICENSE.md) for details. diff --git a/package.json b/package.json index db9cb22..c7c6685 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "private": true, "scripts": { "clean": "lerna clean", + "docker:build": "lerna run build --scope '@(honeycomb-layout|example-*)'", "test": "lerna run test --scope *honeycomb*", "postinstall": "lerna bootstrap --scope *honeycomb*", "generate": "node scripts/generate-examples.js && lerna bootstrap", diff --git a/packages/generator-honeycomb/app/templates/.dockerignore b/packages/generator-honeycomb/app/templates/.dockerignore index cc3da57..c5d6393 100644 --- a/packages/generator-honeycomb/app/templates/.dockerignore +++ b/packages/generator-honeycomb/app/templates/.dockerignore @@ -1,8 +1,12 @@ coverage -logs node_modules -pids -dist +src +test +.babelrc +.dockerignore +.DS_Store +.eslintignore +.eslintrc.yml +.stylelintrc.yml npm-debug.log Dockerfile -.dockerignore diff --git a/packages/generator-honeycomb/app/templates/_Dockerfile b/packages/generator-honeycomb/app/templates/_Dockerfile index ffc1179..d00f685 100644 --- a/packages/generator-honeycomb/app/templates/_Dockerfile +++ b/packages/generator-honeycomb/app/templates/_Dockerfile @@ -1,7 +1,9 @@ -FROM node:latest +FROM node:alpine # Install Yarn -RUN curl -o- -L https://yarnpkg.com/install.sh | bash +RUN apk add --no-cache --virtual .build-deps tar curl bash gnupg \ + && curl -o- -L https://yarnpkg.com/install.sh | bash \ + && apk del .build-deps ENV PATH /root/.yarn/bin:$PATH # Create app directory @@ -13,16 +15,16 @@ ENV NODE_ENV production # Install app dependencies COPY package.json /code/<%= dir %>/ -RUN yarn --pure-lockfile +RUN apk add --no-cache --virtual .app-deps python make g++ \ + && yarn --pure-lockfile \ + && yarn cache clean \ + && apk del .app-deps # Bundle app source COPY . /code/<%= dir %> -# Build -RUN yarn run build - # Port EXPOSE <%= port %> # Start -CMD [ "npm", "start" ] +CMD [ "yarn", "start" ] diff --git a/packages/honeycomb-layout/.dockerignore b/packages/honeycomb-layout/.dockerignore index cc3da57..d508f67 100644 --- a/packages/honeycomb-layout/.dockerignore +++ b/packages/honeycomb-layout/.dockerignore @@ -1,8 +1,12 @@ +__tests__ coverage -logs node_modules -pids -dist +src +.babelrc +.dockerignore +.DS_Store +.eslintignore +.eslintrc.yml npm-debug.log Dockerfile -.dockerignore +README.md diff --git a/packages/honeycomb-layout/Dockerfile b/packages/honeycomb-layout/Dockerfile index ba5db8e..98e03dd 100644 --- a/packages/honeycomb-layout/Dockerfile +++ b/packages/honeycomb-layout/Dockerfile @@ -1,7 +1,9 @@ -FROM node:latest +FROM node:alpine # Install Yarn -RUN curl -o- -L https://yarnpkg.com/install.sh | bash +RUN apk add --no-cache --virtual .build-deps tar curl bash gnupg \ + && curl -o- -L https://yarnpkg.com/install.sh | bash \ + && apk del .build-deps ENV PATH /root/.yarn/bin:$PATH # Create app directory @@ -12,17 +14,17 @@ WORKDIR /code/honeycomb-layout ENV NODE_ENV production # Install app dependencies -COPY package.json /code/honeycomb-layout -RUN yarn --pure-lockfile +COPY package.json /code/honeycomb-layout/ +RUN apk add --no-cache --virtual .app-deps python make g++ \ + && yarn --pure-lockfile \ + && yarn cache clean \ + && apk del .app-deps # Bundle app source COPY . /code/honeycomb-layout -# Build -RUN yarn run build - # Port EXPOSE 3000 # Start -CMD [ "npm", "start" ] +CMD [ "yarn", "start" ]