commit 0abb1b5550fc9a330b3f64762240d1142cc4349c Author: Isaac Date: Mon Apr 13 14:20:53 2026 +0300 initial commit diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7c3119e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM httpd:2.4-alpine + +# Copy your landing page into Apache's web root +COPY index.html /usr/local/apache2/htdocs/ + +# Expose port 80 +EXPOSE 80 \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..b77c968 --- /dev/null +++ b/README.md @@ -0,0 +1,145 @@ +# Simple CI/CD Demo with Docker, Nginx, and GitLab CI + +This repository demonstrates a **minimal end-to-end CI/CD pipeline** using **Docker**, **Nginx**, and **GitLab CI/CD**. +The project intentionally uses a **very simple static webpage** to focus on illustrating the **build, registry, and deployment workflow** rather than application complexity. + +--- + +## Overview + +The repository contains a small static website served by **Nginx running in a Docker container**. +A **GitLab CI/CD pipeline** automatically builds the Docker image, pushes it to the container registry, and deploys it to a remote server. + +This setup demonstrates a **complete CI/CD lifecycle**: + +1. Developer pushes code to the repository +2. GitLab CI pipeline triggers automatically +3. Docker image is built from the `Dockerfile` +4. Image is pushed to the container registry +5. Deployment server pulls the new image +6. Container is started or updated on the server + +--- + +## Repository Structure +``` +. +├── index.html # Simple static webpage +├── Dockerfile # Builds the Nginx container +├── .gitlab-ci.yml # CI/CD pipeline configuration +└── README.md # Project documentation +``` + +--- + +## Application + +The application consists of a **single static HTML page** served by **Nginx**. + +The page is packaged inside a Docker container and served via an **Nginx server running on Alpine Linux**, providing a lightweight and efficient runtime environment. + +--- + +## Docker Setup + +The `Dockerfile` builds a container using: + +- **Nginx** +- **Alpine Linux base image** +- The static `index.html` copied into the default Nginx web directory + +Typical responsibilities of the container: + +- Start an Nginx server +- Serve the static HTML page +- Expose the HTTP port + +--- + +## CI/CD Pipeline + +The `.gitlab-ci.yml` file defines the automated pipeline used by **GitLab CI/CD**. + +### Pipeline Stages + +1. **Build** + - Builds the Docker image from the repository's `Dockerfile`. + +2. **Push** + - Tags and pushes the image to the **GitLab Container Registry**. + +3. **Deploy** + - Connects to the deployment server using **SSH** + - Pulls the latest image from the registry + - Runs (or replaces) the container on the server + +--- + +## Deployment Flow + +``` +Developer Push +│ +▼ +GitLab CI Pipeline +│ +├── Build Docker Image +│ +├── Push to Container Registry +│ +▼ +Deployment Server (SSH) +│ +├── Pull Latest Image +└── Run Container +``` + + +--- + +## Purpose of This Repository + +This repository serves as a **minimal working example of a CI/CD pipeline** that demonstrates: + +- Containerizing a web application +- Automating builds using GitLab CI +- Publishing Docker images to a registry +- Deploying containers remotely using SSH + +Because the application itself is intentionally simple, the focus remains on **understanding the CI/CD workflow**. + +--- + +## Use Cases + +This project can be used for: + +- Learning CI/CD fundamentals +- Demonstrating Docker build pipelines +- Testing GitLab CI deployment strategies +- Teaching DevOps workflows with minimal complexity + +--- + +## Requirements + +To run or adapt this pipeline you typically need: + +- GitLab repository with CI/CD enabled +- GitLab Container Registry access +- Docker installed on the deployment server +- SSH access configured for CI/CD deployment + +--- + +## Summary + +This project demonstrates a **simple but complete DevOps workflow**: + +- Static web page +- Dockerized with Nginx (Alpine base) +- Automated build and registry push +- Remote deployment via GitLab CI/CD + +It provides a clear and lightweight example of **how CI/CD pipelines automate containerized application delivery**. + diff --git a/index.html b/index.html new file mode 100644 index 0000000..10eff8d --- /dev/null +++ b/index.html @@ -0,0 +1,126 @@ + + + + + + Campus DevOps Meetup + + + + + + + + +
+
+

+ Learn DevOps.
+ Build Faster.
+ Ship Better. +

+

+ A hands-on DevOps meetup for campus CS students. Learn CI/CD, Docker, cloud basics, + and how real teams ship software. +

+ +
+ +
+
+$ git clone campus-devops-meetup
+$ docker build -t hello-devops .
+$ kubectl apply -f deployment.yaml
+🚀 Deployed successfully!
+      
+
+
+ + +
+
+

What You’ll Learn

+
+
+

CI/CD Pipelines

+

+ Build automated pipelines using GitHub Actions and learn how real teams ship code. +

+
+
+

Docker & Containers

+

+ Package your apps with Docker and run them anywhere. +

+
+
+

Cloud & Kubernetes

+

+ Learn how apps scale in the cloud with Kubernetes basics. +

+
+
+
+
+ + +
+

Meetup Agenda

+
+
+ 🎤 Intro to DevOps + 15 min +
+
+ ⚙️ CI/CD Demo + 30 min +
+
+ 🐳 Docker Hands-on + 30 min +
+
+ ☁️ Cloud Q&A + Networking + 30 min +
+
+
+ + +
+
+

Join the DevOps Meetup

+

+ Free for campus CS students. Limited seats. Register now. +

+ +
+ + + + +
+
+
+ + + + + + \ No newline at end of file diff --git a/manifest.yaml b/manifest.yaml new file mode 100644 index 0000000..a2387e1 --- /dev/null +++ b/manifest.yaml @@ -0,0 +1,61 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: mywebapp +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: mywebapp-config + namespace: mywebapp +data: + APP_ENV: "production" + LOG_LEVEL: "info" +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mywebapp + namespace: mywebapp +spec: + replicas: 2 + selector: + matchLabels: + app: mywebapp + template: + metadata: + labels: + app: mywebapp + spec: + containers: + - name: mywebapp + image: 10.10.131.45:30500/mywebapp:latest + imagePullPolicy: Always + ports: + - containerPort: 80 + env: + - name: APP_ENV + valueFrom: + configMapKeyRef: + name: mywebapp-config + key: APP_ENV + - name: LOG_LEVEL + valueFrom: + configMapKeyRef: + name: mywebapp-config + key: LOG_LEVEL +--- +apiVersion: v1 +kind: Service +metadata: + name: mywebapp-service + namespace: mywebapp +spec: + selector: + app: mywebapp + ports: + - protocol: TCP + port: 80 + targetPort: 80 + type: NodePort + \ No newline at end of file