Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker support #73

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules
npm-debug.log
Dockerfile*
docker-compose*
.dockerignore
.git
.gitignore
README.md
LICENSE
.vscode
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM node:10-alpine

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
COPY package*.json ./
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the yarn lock file in this step as well to improve build caching

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah the repo doesn’t lock down the transitive dependencies.

Maybe @Bogdan-Lyashenko can explain his reasoning behind it

RUN yarn install

# Bundle app source
COPY . .

EXPOSE 2018 3018 8888 9229
CMD [ "yarn", "start" ]
idoo marked this conversation as resolved.
Show resolved Hide resolved
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,24 @@ Check out the example of [**standalone version running here**](https://codecrumb
<img src="/docs/main-ui-3.png" width="100%"/>

## Get started

So basically you have 2 ways:
- Install and run
- Run with Docker

### Install and run
>Pre-condition: update/install `NodeJS` version to be >= *8.11.1*

1) Install ```codecrumbs``` globally (```yarn global add codecrumbs```)
2) Run ```codecrumbs -d project-src-dir -e project-src-dir/index.js```. Change parameters to match your project:```-d``` is *directory with source code*, ```-e``` is *entry point file* .
3) Go to [http://localhost:2018](http://localhost:2018/#) in the browser to check it out.

### Docker
To start dockerise application run
`docker build -t codecrumbs .`
and once docker image will be build successfully
`docker run -p 2018:2018 -d codecrumbs`

### CLI
Parameter | Description | Example
--- | --- | ---
Expand Down
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3'

services:
codecrumbs:
build: .
volumes:
- .:/usr/src/app
- /usr/src/app/node_modules
ports:
- 2018:2018
- 3018:3018
- 9229:9229
- 8888:8888
command: yarn start
idoo marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion src/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const setup = (options, devOptions) => {
} = options;

const PORT_IN_USE = 'open';
const HOST = '127.0.0.1';
const HOST = '0.0.0.0';

validateProjectPath(projectDir, entryPoint);

Expand Down