From 8cb87ae35dab9d135636fc9e088c2c765c39f69c Mon Sep 17 00:00:00 2001 From: VineeTagarwaL-code Date: Sat, 28 Sep 2024 22:17:43 +0530 Subject: [PATCH] fix: docker caching issue fix --- .dockerignore | 3 ++- .github/workflows/cd.yaml | 2 +- docker-compose.yml | 3 +-- public/sitemap.xml | 6 +++--- src/app/actions/blog.action.ts | 1 + src/app/page.tsx | 3 ++- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.dockerignore b/.dockerignore index 2205207..35f5dfd 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,3 @@ node_modules/ -.next/ \ No newline at end of file +.next/ +.env \ No newline at end of file diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index c080022..15da45c 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -24,7 +24,7 @@ jobs: - name: Build and push Docker image run: | - docker build -t vineetagarwal2004/blog:${{ github.sha }} -t vineetagarwal2004/blog:latest . + docker build -t vineetagarwal2004/blog:${{ github.sha }} -t vineetagarwal2004/blog:latest . --no-cache docker push --all-tags vineetagarwal2004/blog - name: Deploy to EC2 diff --git a/docker-compose.yml b/docker-compose.yml index 661b366..09e84ac 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,9 +2,8 @@ version: '3.8' services: nextjs: - image: vineetagarwal2004/blog:latest + image: my-blog-app:latest container_name: blog - ports: - "3000:3000" env_file: diff --git a/public/sitemap.xml b/public/sitemap.xml index b8e6839..a7d80dd 100644 --- a/public/sitemap.xml +++ b/public/sitemap.xml @@ -1,6 +1,6 @@ -https://blog.vineet.tech/blog2024-09-25T21:44:32.383Zdaily0.7 -https://blog.vineet.tech/tags2024-09-25T21:44:32.383Zdaily0.7 -https://blog.vineet.tech2024-09-25T21:44:32.383Zdaily0.7 +https://blog.vineet.tech/tags2024-09-28T16:23:23.761Zdaily0.7 +https://blog.vineet.tech/blog2024-09-28T16:23:23.762Zdaily0.7 +https://blog.vineet.tech2024-09-28T16:23:23.762Zdaily0.7 \ No newline at end of file diff --git a/src/app/actions/blog.action.ts b/src/app/actions/blog.action.ts index 0d1052f..77622c6 100644 --- a/src/app/actions/blog.action.ts +++ b/src/app/actions/blog.action.ts @@ -10,6 +10,7 @@ import rehypeSlug from "rehype-slug"; import { SuccessResponse } from "@/lib/success"; const getBlogs = withServerActionAsyncCatcher(async () => { + console.log("Fetching blogs"); const response = await axios.get( `https://api.github.com/repos/${process.env.GITHUB_USERNAME}/${process.env.GITHUB_REPO_NAME}/git/trees/main?recursive=1`, { diff --git a/src/app/page.tsx b/src/app/page.tsx index 3d2af07..85a0e70 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,7 +1,8 @@ -"use server"; import { Blogs } from "@/components/blogs"; import { Introduction } from "@/components/introduction"; import { getBlogs } from "./actions/blog.action"; + +export const revalidate = 10; export default async function Home() { let blogsMeta: Meta[] | undefined; try {