CI/CD Pipeline for NGINX on Docker — Phase 2: Creating the Docker Image
·1 min read
by Frank Doka
Article
CI/CD Pipeline for NGINX on Docker — Phase 2: Creating the Docker Image
Phase 2 packages the web server into a portable container — ready to run identically on a laptop or an EC2 instance.
What I Built
- Static site — Simple HTML/CSS page. The focus is on the pipeline, not the frontend.
- NGINX configuration — Configured NGINX to serve the static content over HTTPS using a self-signed OpenSSL certificate.
- Dockerfile — Multi-step build: installs NGINX, generates the SSL certificate, copies the site content and NGINX config into the image.
- Local testing — Ran
docker buildanddocker runlocally, hithttps://localhost, confirmed the certificate was served and the page rendered correctly. - Docker Hub push — Tagged and pushed the image to Docker Hub so Ansible can pull it onto EC2 in Phase 4.
What's Next
Phase 3 uses Terraform to provision the EC2 instance that will host this container.