A base container for building nodejs app containers.
222
This is a container based off the official node build for easing the process of automating builds of nodejs applications.
It is a base container and does nothing by itself. The intention is for this container to be easily extended to containerize node applications.
/var/opt/nodesrcwoosteln_nodebase/var/opt/nodesrc directory using CMD [node, index.js]Basically you want to create a Dockerfile within your node apps directory extending this image, copy your sourcecode into /var/opt/nodesrc and make sure it's configured ( either by using the NODE_ENV environment variable or a hardcoded configuration file ) to listen on ports 80 or 443. ( I would recommend using node-config )
Example Dockerfile:
FROM woosteln/nodebase:latest
MAINTAINER Your Name "[email protected]"
ADD . /var/opt/nodesrc
You can then run:
docker build -t my/exampleNodeContainer .
docker run -d --name myExample -p 8080:80 my/exampleNodeContainer
And it should be good.
If you make your extension and then create an automated build process based on your project's repository, boom. You have an automatically containerized nodejs application.
Maybe you override the CMD to be CMD [ 'npm', 'test' ] so you use it in CI. Or maybe (keep it portable ) your CI script executes
# Pull latest
docker pull my/exampleNodeContainer
# Stop and remove existing
docker stop myExample
docker rm myExample
# Run tests
docker run --rm --name myExample -p 8080:80 my/exampleNodeContainer npm test
Nice!
Regarding your npm packages.... You might want to freeze them to a particular version. We're just going to run npm install on whatever you've declared.
Regarding bower... same things goes. If you've provided a bower.json in your app, make sure the package versions are exactly the ones you want. We run bower without any prompts so if there are version conflicts, the install will fail!
Content type
Image
Digest
Size
247.6 MB
Last updated
over 10 years ago
docker pull woosteln/nodebase