diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..8c36434e3 --- /dev/null +++ b/Dockerfile @@ -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///' /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"] diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000..d86294cdf --- /dev/null +++ b/Jenkinsfile @@ -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!" + } + } + } +} + diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 000000000..4c14b43a7 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,7 @@ +services: + web: + image: aslesha18/website + container_name: website-container + ports: + - "82:82" + restart: always diff --git a/index.html b/index.html index 19c25caa0..5b08d2e30 100644 --- a/index.html +++ b/index.html @@ -3,6 +3,7 @@ Intellipaat -

Hello world!

+

Hey There, I'm Aslesha Borkar!

+