Giter Club home page Giter Club logo

docker-nodejs's Introduction

Node.JS On Build Container

Build Status

This is an onbuild container for Node.JS Projects.

Usage

This docker container is an ONBUILD. Simply extend the Dockerfile in your application with this Dockerfile and your project will be copied into the /app directory and have npm install run on it. You must ensure that your downstream images sets USER nodejs and additionally in rare cases any required permission beyond read. You must also ensure that your application will listen on port 8080.

Please note, storing state on this container is not recommended, and logs should be written to stdout, thus adding further permissions isn't something we'd normally envision.

Container Parameters

  • start, test or run will run npm COMMAND

The following command will run npm start on the code within the container

So if your Dockerfile looks like this

FROM quay.io/ukhomeofficedigital/nodejs:v3.0.0

USER nodejs
CMD ["start"]

The following will run npm start:

docker run your-docker-container:latest

You can also run arbitrary commands such as:

docker run your-docker-container:latest /opt/nodejs/bin/npm run 

However, we'd prefered there was a standard way to start your app and thus, have settled on npm start being the canonical way to run your app.

Useful Directories

  • /app - Where you app will be copied to on build

Contributing

Feel free to submit pull requests and issues. If it's a particularly large PR, you may wish to discuss it in an issue first.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Versioning

We use SemVer for the version tags available See the tags on this repository.

Build With

  • Node v4.4.2

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the GPL v2 License - see the LICENSE.md file for details

Acknowledgments

docker-nodejs's People

Contributors

daniel-ac-martin avatar mikeyhu avatar purplebooth avatar timgent avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-nodejs's Issues

using ONBUILD npm install doesn't allow for any yum dependencies to be installed before npm tries to install stuff

If one of the NPM packages I want to install has extra YUM dependencies then I don't get the chance to install them before 'npm install' is invoked via the ONBUILD.

Not sure if there is a solution to this other than:

  • adding extra required dependencies into this container build
  • creating a completely different image similar to this but with my required dependencies

Any other ideas? Am I missing something obvious?
There was an issue raised on Docker about it but doesnt seem to have been implemented:
moby/moby#8240

make this not run as root.

We probably shouldn't really be doing our npm install as root, nor should we be running our apps as root. I think we need to add a user. I dare say we should add the user upstream in the centos base and consume a standard user everywhere we want to run non-privilege stuff (pretty much everywhere I guess). More importantly, adding the user upstream will mean we have the same UID everywhere.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.