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

[CLI] add --dockerize flag to the lb4 app command #2351

Closed
3 tasks
emonddr opened this issue Feb 7, 2019 · 5 comments
Closed
3 tasks

[CLI] add --dockerize flag to the lb4 app command #2351

emonddr opened this issue Feb 7, 2019 · 5 comments
Assignees

Comments

@emonddr
Copy link
Contributor

emonddr commented Feb 7, 2019

To minimize the number of steps that a user needs to take to get a scaffolded application to run inside a docker container (and later kubernetes), a new --dockerize flag is needed in the lb4 app command.

  1. A .dockerignore file needs to be created with contents:
node_modules
npm-debug.log
  1. A Dockerfile needs to be created with contents:
FROM node:10.14-alpine

EXPOSE 3000

COPY package.json package.json
RUN npm install

COPY . .


RUN npm run build

CMD ["npm", "start" ]

The port we expose in the Dockerfile would need to be aligned with the value in the index.js file.
The node docker image value , for example: node:10.14-alpine , would have to be a valid/recent docker image for node. The CLI would prompt for these values or offer valid values as default.

  1. Perhaps two helper bash scripts to create a docker image, and run the application in a docker container

(Not sure how much hand-holding we need to do with regards to docker commands. There are several docker commands [list images, delete images, start container, stop container, show container logs]. We need to pick the right balance of helping the user via scripts or via documentation of useful commands)

Related to : #1606

Acceptance Criteria

  • creates Dockerfile with appropriate EXPOSE value and FROM value
  • creates .dockerignore
  • user is able to quickly run the scaffolded application in a Docker container and access the REST application endpoints successfully via browser or curl commands

TBD

The host value needs to change in the index.js for the REST endpoints of the application to be accessible via browser or curl commands. Depends on the outcome of #2350

@emonddr
Copy link
Contributor Author

emonddr commented Feb 7, 2019

Do we also need to entertain Docker Compose? A single YAML file , docker-compose.yml, which defines many different apps (running on docker containers) , and user can start/stop all of them at once using docker-compose up or docker-compose down.

https://docs.docker.com/compose/overview/

@raymondfeng
Copy link
Contributor

Let's start with a simple --docker option to generate Dockerfile and related files.

@raymondfeng
Copy link
Contributor

We should align with https://www.cloudnativejs.io/ (IBM runtime's initiative to make Node.js application to be cloud native and it defines conventions for docker/helm/k8s integration).

@dhmlau
Copy link
Member

dhmlau commented Jun 18, 2019

@emonddr, is this already done, because we now have the --docker option? Thanks.

@emonddr
Copy link
Contributor Author

emonddr commented Jul 10, 2019

Already done in PR : #2437 .

@emonddr emonddr closed this as completed Jul 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants