1. Inside the project directory, create a Dockerfile
# Use Node.js base image
FROM node:16-alpine
# Set working directory
WORKDIR /app
# Copy package.json and package-lock.json
COPY package*.json ./
# Install dependencies
RUN npm install
# Copy application code
COPY . .
# Expose the application port (e.g., 3000)
EXPOSE 3000
# Start the application
CMD ["npm", "start"]
Build and Run Docker Container
1. Build the Docker image
docker-compose build (if you have docker-compose.yml)
docker run -d -p 3000:3000 --name node_structure node:20 tail -f /dev/null
(if you do not have docker-compose.yml)
Also, docker-compose is (being) depricated in favor to the compose plugin.
Commands should be "docker compose..." not "docker-compose" with the plugin.
Otherwise, useful information for anyone who needs to add docker and git on a fresh linux install.
Experienced software developer with 8 years of expertise in PHP, Laravel, Node.js, and server management. Proficient in building scalable web applications and delivering robust application
Experienced software developer with 8 years of expertise in PHP, Laravel, Node.js, and server management. Proficient in building scalable web applications and delivering robust application
Experienced software developer with 8 years of expertise in PHP, Laravel, Node.js, and server management. Proficient in building scalable web applications and delivering robust application
Experienced software developer with 8 years of expertise in PHP, Laravel, Node.js, and server management. Proficient in building scalable web applications and delivering robust application
Top comments (8)
Also, docker-compose is (being) depricated in favor to the compose plugin.
Commands should be "docker compose..." not "docker-compose" with the plugin.
Otherwise, useful information for anyone who needs to add docker and git on a fresh linux install.
thanks for clarification
Why don't you install Compose from the packages as well? (
apt install docker-compose-plugin
)*You can refer below link for upload code using ci/cd pipeline of github actions
*
upload code using ci/cd pipeline of github actions
Was worth reading, thanks for information
thanks
hey I m Ilyas from Morocco can someone explain how to get my GitHub repository Node.js application to start install docker
you can create new empty repository in github and then upload node js code to that repo