{"id":20828330,"url":"https://github.com/codewithmuh/dockerize-nodejs","last_synced_at":"2025-04-10T03:36:07.624Z","repository":{"id":245812083,"uuid":"819088979","full_name":"codewithmuh/dockerize-nodejs","owner":"codewithmuh","description":"Dockerize Nodejs app using chainguard","archived":false,"fork":false,"pushed_at":"2024-06-24T08:43:05.000Z","size":7,"stargazers_count":2,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-07T14:12:22.483Z","etag":null,"topics":["chainguard-images","nodejs"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codewithmuh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-23T18:39:56.000Z","updated_at":"2024-08-05T10:40:00.000Z","dependencies_parsed_at":"2024-06-24T10:06:11.029Z","dependency_job_id":"322c1d91-ef64-48f6-9066-66d34e39570e","html_url":"https://github.com/codewithmuh/dockerize-nodejs","commit_stats":null,"previous_names":["codewithmuh/dockerize-nodejs"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithmuh%2Fdockerize-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithmuh%2Fdockerize-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithmuh%2Fdockerize-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithmuh%2Fdockerize-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codewithmuh","download_url":"https://codeload.github.com/codewithmuh/dockerize-nodejs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248153367,"owners_count":21056418,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chainguard-images","nodejs"],"created_at":"2024-11-17T23:14:31.070Z","updated_at":"2025-04-10T03:36:07.596Z","avatar_url":"https://github.com/codewithmuh.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# My Node.js Server with Docker\n![1i (54)](https://github.com/codewithmuh/dockerize-nodejs/assets/51082957/206e5708-a455-44c1-8532-39d98571a6b9)\n\nYoutube Video Link: https://youtu.be/7FGj4EwOX2E\n\nThis project sets up a basic Node.js server that serves an HTML file. The server is then containerized using Docker.\n\n- `index.html`: The HTML file to be served.\n- `server.js`: The Node.js server code.\n- `Dockerfile`: Instructions to build the Docker image.\n- `.dockerignore`: Specifies which files and directories to ignore when building the Docker image.\n- `package.json`: Contains the project metadata and dependencies.\n\n## Prerequisites\n\n- [Node.js](https://nodejs.org/) (if you need to test the server locally without Docker)\n- [Docker](https://www.docker.com/)\n\n## Setup and Run\n\n### Running the Server Locally\n\n1. Clone the repository:\n\n    ```sh\n    git clone https://github.com/yourusername/my-node-server.git\n    cd my-node-server\n    ```\n\n2. Install dependencies (if any):\n\n    ```sh\n    npm install\n    ```\n\n3. Start the server:\n\n    ```sh\n    npm start\n    ```\n\n4. Open your browser and navigate to `http://localhost:3000`.\n\n### Running the Server with Docker\n\n1. Clone the repository (if you haven't already):\n\n    ```sh\n    https://github.com/codewithmuh/dockerize-nodejs.git\n    cd my-node-server\n    ```\n### Using node:20 docker image\n1. Build the Docker image:\n\n    ```sh\n    docker build -t my-node-server .\n    ```\n\n2. Run the Docker container:\n\n    ```sh\n    docker run -it --rm -p 3000:3000 my-node-server\n    ```\n\n3. Open your browser and navigate to `http://localhost:3000`.\n\n### Using chainguard cgr.dev/chainguard/node:latest docker image\n1. Build the Docker image:\n\n    ```sh\n    docker build -f  Dockerfile-distroless -t my-node-cg .\n    ```\n\n2. Run the Docker container:\n\n    ```sh\n    docker run -it --rm -p 3000:3000 my-node-cg\n    ```\n\n3. Open your browser and navigate to `http://localhost:3000`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewithmuh%2Fdockerize-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodewithmuh%2Fdockerize-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewithmuh%2Fdockerize-nodejs/lists"}