Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Base image
FROM ubuntu:20.04

# Set non-interactive for apt
ENV DEBIAN_FRONTEND=noninteractive

# Update system and install Apache
RUN apt-get update -y && \
apt-get install -y apache2 && \
apt-get clean

# Create working directory
WORKDIR /var/www/html

# Copy website code into the container
COPY . /var/www/html

# Change Apache to listen on port 82 instead of 80
RUN sed -i 's/Listen 80/Listen 82/' /etc/apache2/ports.conf && \
sed -i 's/<VirtualHost \*:80>/<VirtualHost \*:82>/' /etc/apache2/sites-available/000-default.conf

# Expose port 82 for publishing website
EXPOSE 82

# Start Apache in foreground (required for Docker)
CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
28 changes: 28 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
pipeline {
agent {label "ubuntu"}

stages {
stage("Clone Code"){
steps {
echo "Cloning repository"
git url: "https://github.com/AsleshaBorkar/website.git", branch:"patch-1"
echo "code cloning is successful"
}
}
stage("Build Docker Image"){
steps {
echo "Building Docker image"
sh "docker build -t website:latest ."
}
}

stage("Deploy Container"){
steps {
echo "Deploying container"
sh "docker compose down && docker compose up -d --build"
echo "Deployment is done!"
}
}
}
}

7 changes: 7 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
services:
web:
image: aslesha18/website
container_name: website-container
ports:
- "82:82"
restart: always
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<title> Intellipaat </title>
</head>
<body style = "background-image:url('images/github3.jpg'); background-size: 100%">
<h2 ALIGN=CENTER>Hello world!</h2>
<h2 ALIGN=CENTER>Hey There, I'm Aslesha Borkar!</h2>
</body>
</html>