Introduction
DevOps combines development and operations to improve collaboration and automate software delivery. This tutorial covers essential DevOps concepts and tools.
Setting Up Jenkins
# Install Jenkins on Ubuntu
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
echo "deb https://pkg.jenkins.io/debian binary/" | sudo tee /etc/apt/sources.list.d/jenkins.list
sudo apt update
sudo apt install jenkins
Docker Integration
# Dockerfile example
FROM node:14
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ["npm", "start"]
CI/CD Pipeline Script
pipeline {
agent any
stages {
stage("Build") {
steps {
sh "docker build -t myapp:latest ."
}
}
stage("Test") {
steps {
sh "npm test"
}
}
stage("Deploy") {
steps {
sh "docker run -d -p 3000:3000 myapp:latest"
}
}
}
}
This tutorial introduces essential DevOps practices including continuous integration, deployment automation, and infrastructure as code.