From f54276f73a71cf52549c95077e07146d3185facf Mon Sep 17 00:00:00 2001 From: Pranav Verma Date: Sun, 15 Jun 2025 00:41:23 +0530 Subject: [PATCH 1/2] Update: Added Dockerfile, and Moved Files. --- .github/workflows/pages.yml | 2 +- Dockerfile | 39 +++++++++++++++++++++++++++++++++ index.html => public/index.html | 0 style.css => public/style.css | 0 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 Dockerfile rename index.html => public/index.html (100%) rename style.css => public/style.css (100%) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 03c7ff7..2fb4ed1 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -37,7 +37,7 @@ jobs: uses: actions/upload-pages-artifact@v3 with: # Upload entire repository - path: '.' + path: 'public' - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2953491 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,39 @@ +# Use the official Nginx image as the base image +FROM nginx:alpine + +# Remove the default Nginx static assets +RUN rm -rf /usr/share/nginx/html/* + +# Copy the static website files to the Nginx html directory +COPY public/ /usr/share/nginx/html/ +COPY LICENSE /usr/share/nginx/html/ + +# Create a custom Nginx configuration for better performance +RUN echo 'server { \ + listen 80; \ + server_name localhost; \ + root /usr/share/nginx/html; \ + index index.html; \ + \ + location / { \ + try_files $uri $uri/ /index.html; \ + } \ + \ + # Enable gzip compression \ + gzip on; \ + gzip_vary on; \ + gzip_min_length 1024; \ + gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json; \ + \ + # Cache static assets \ + location ~* \.(css|js|png|jpg|jpeg|gif|ico|svg)$ { \ + expires 1y; \ + add_header Cache-Control "public, immutable"; \ + } \ +}' > /etc/nginx/conf.d/default.conf + +# Expose port 80 +EXPOSE 80 + +# Start Nginx when the container launches +CMD ["nginx", "-g", "daemon off;"] diff --git a/index.html b/public/index.html similarity index 100% rename from index.html rename to public/index.html diff --git a/style.css b/public/style.css similarity index 100% rename from style.css rename to public/style.css From dc8ac340c107a01a69a8e02b0f29818b8ba7f791 Mon Sep 17 00:00:00 2001 From: Pranav Verma Date: Sun, 15 Jun 2025 00:53:35 +0530 Subject: [PATCH 2/2] Update: Added Docker Deployment Actions. --- .github/workflows/docker.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..81fa558 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,21 @@ +name: Docker Build & Push + +on: + push: + branches: [ "*" ] + pull_request: + branches: [ "*" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Build the Main Portfolio Docker image + run: | + docker build . --tag ghcr.io/upstride-edu/website:latest + - name: Login to GitHub Container Registry + run: echo "${{ secrets.GHCR_PAT }}" | docker login ghcr.io -u PranavVerma-droid --password-stdin + - name: Push the Docker image + run: docker push ghcr.io/upstride-edu/website:latest \ No newline at end of file