Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/trickfilm400/generic-nodejs-docker
A nodejs docker image to run a project without building a new docker everytime
https://github.com/trickfilm400/generic-nodejs-docker
alpine docker generic nodejs npm template
Last synced: 2 days ago
JSON representation
A nodejs docker image to run a project without building a new docker everytime
- Host: GitHub
- URL: https://github.com/trickfilm400/generic-nodejs-docker
- Owner: Trickfilm400
- License: mit
- Created: 2021-08-26T23:03:58.000Z (about 3 years ago)
- Default Branch: node-20
- Last Pushed: 2023-12-12T06:12:11.000Z (11 months ago)
- Last Synced: 2023-12-12T07:25:34.176Z (11 months ago)
- Topics: alpine, docker, generic, nodejs, npm, template
- Language: Shell
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# generic-nodejs-docker
A nodejs docker image to run a project without building a new docker everytimeYou can use this docker to run every lightweight node.js program.
The docker will install the dependencies on startup and execute the `npm start` script of your package.json afterwards.
# Usage
Download the docker image from [Docker-Hub](https://hub.docker.com/r/n404/generic-nodejs): `docker pull n404/generic-nodejs`## local folder
The most simple usage:
`docker run --rm -v /root/project/:/app n404/generic-nodejs`### Preparations
Put your NodeJS project on the machine your docker will run on.
In this example, I will use the “/root/project” directory for our project.Ensure the package.json file is correctly copied to “/root/project/package.json”.
This file needs a NPM run script:
```json
{
"name": "your-project",
"version": "0.0.1",
"description": "your-project-description",
"main": "./index.js",
"scripts": {
"start": "node index.js"
}
}
```To run the docker container use: `docker run -v /root/project:/app n404/generic-nodejs`
You are mounting your NodeJS project folder inside the docker.
If you want to, you can pass additional docker run parameters as you need to the run command, but ensure you pass the folder to the docker container.## Zip URL from GitHub
There are some environment variables to configure the behavior of the container:
| ENV | default | description
---------|-------------|-------------------
| CACHE | `true` | If false, the ZIP-File will be downloaded at every container start
| URL | "" | The zip URL _(see below for more information)_
| BUILD_TYPESCRIPT | `false` | if `npm run build` should be executed for compiling for example typescript### Usage
`docker run -e URL=https://github.com/Trickfilm400/vantage-node/archive/refs/heads/master.zip -e BUILD_TYPESCRIPT=true -e CUSTOM_VARIABLE=false -e CACHE=true n404/generic-nodejs:test`
(replace the environment variables with your values or remove them from the command, only the `URL` value is required)
### **IMPORTANT NOTE: zip file**
the zip file must include a subfolder like a zip folder from GitHub
(folder.zip → folder/subfolder/project [package.json etc.])I was too lazy to make an autodetect thing for this.
© Trickfilm400 14.08.2021 - 27.08.2021 - 29.07.2022 - 30.10.2022 - 12.12.2023