diff --git a/AI_RULES.md b/AI_RULES.md index d74e324..e200943 100644 --- a/AI_RULES.md +++ b/AI_RULES.md @@ -1,6 +1,6 @@ # Project Overview -This is a Starter pack to kick start a web project with nextjs as frontend and go server as backend. +This is to kick start a web project with nextjs as frontend and go server as backend. ## Structure diff --git a/docker-compose.yml b/docker-compose.yml index 64a7924..5ae639e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,15 +1,15 @@ services: - backend: - build: - context: ./backend - dockerfile: Dockerfile - restart: unless-stopped - ports: - - "${BACKEND_PORT}:8000" - environment: - - BACKEND_PORT=${BACKEND_PORT} - networks: - - ${DOCKER_WEB_NETWORK} + # backend: + # build: + # context: ./backend + # dockerfile: Dockerfile + # restart: unless-stopped + # ports: + # - "${BACKEND_PORT}:8000" + # environment: + # - BACKEND_PORT=${BACKEND_PORT} + # networks: + # - starter_network frontend: build: @@ -20,13 +20,11 @@ services: - "${FRONTEND_PORT}:3000" environment: - NODE_ENV=production - - NEXT_PUBLIC_API_URL=${PROD_API_URL} - - PROD_URL=${PROD_URL} - depends_on: - - backend + # depends_on: + # - backend networks: - - ${DOCKER_WEB_NETWORK} + - starter_network networks: - ${DOCKER_WEB_NETWORK}: + starter_network: driver: bridge diff --git a/frontend/Dockerfile b/frontend/Dockerfile new file mode 100644 index 0000000..f6282cc --- /dev/null +++ b/frontend/Dockerfile @@ -0,0 +1,31 @@ +# Use official Node.js v22.15.0 image +FROM node:22.15.0-alpine AS builder + +# Set working directory +WORKDIR /app + +# Install dependencies only when needed +COPY package.json package-lock.json ./ +RUN npm ci --prefer-offline --no-audit + +# Copy the rest of the application code +COPY . . + +# Build the Next.js app +RUN npm run build + +# Production image, copy built assets from builder +FROM node:22.15.0-alpine AS runner +WORKDIR /app + +ENV NODE_ENV=production + +# Copy only necessary files for running the app +COPY --from=builder /app/.next .next +COPY --from=builder /app/public ./public +COPY --from=builder /app/package.json ./package.json +COPY --from=builder /app/node_modules ./node_modules + +EXPOSE 3000 + +CMD ["npm", "start"] \ No newline at end of file diff --git a/frontend/public/file.svg b/frontend/public/file.svg deleted file mode 100644 index 004145c..0000000 --- a/frontend/public/file.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/frontend/public/globe.svg b/frontend/public/globe.svg deleted file mode 100644 index 567f17b..0000000 --- a/frontend/public/globe.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/frontend/public/next.svg b/frontend/public/next.svg deleted file mode 100644 index 5174b28..0000000 --- a/frontend/public/next.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/frontend/public/vercel.svg b/frontend/public/vercel.svg deleted file mode 100644 index 7705396..0000000 --- a/frontend/public/vercel.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/frontend/public/window.svg b/frontend/public/window.svg deleted file mode 100644 index b2b2a44..0000000 --- a/frontend/public/window.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/frontend/src/app/favicon.ico b/frontend/src/app/favicon.ico index 718d6fe..f7bd385 100644 Binary files a/frontend/src/app/favicon.ico and b/frontend/src/app/favicon.ico differ diff --git a/frontend/src/app/globals.css b/frontend/src/app/globals.css index a2dc41e..e69de29 100644 --- a/frontend/src/app/globals.css +++ b/frontend/src/app/globals.css @@ -1,26 +0,0 @@ -@import "tailwindcss"; - -:root { - --background: #ffffff; - --foreground: #171717; -} - -@theme inline { - --color-background: var(--background); - --color-foreground: var(--foreground); - --font-sans: var(--font-geist-sans); - --font-mono: var(--font-geist-mono); -} - -@media (prefers-color-scheme: dark) { - :root { - --background: #0a0a0a; - --foreground: #ededed; - } -} - -body { - background: var(--background); - color: var(--foreground); - font-family: Arial, Helvetica, sans-serif; -} diff --git a/frontend/src/app/layout.tsx b/frontend/src/app/layout.tsx index f7fa87e..ed14f4e 100644 --- a/frontend/src/app/layout.tsx +++ b/frontend/src/app/layout.tsx @@ -13,22 +13,18 @@ const geistMono = Geist_Mono({ }); export const metadata: Metadata = { - title: "Create Next App", - description: "Generated by create next app", + title: "Webapp Starter", + description: "Created by FMC", }; export default function RootLayout({ children, -}: Readonly<{ +}: { children: React.ReactNode; -}>) { +}) { return ( - - {children} - + {children} ); } diff --git a/frontend/src/app/page.tsx b/frontend/src/app/page.tsx index e68abe6..8364553 100644 --- a/frontend/src/app/page.tsx +++ b/frontend/src/app/page.tsx @@ -1,103 +1,3 @@ -import Image from "next/image"; - export default function Home() { - return ( -
-
- Next.js logo -
    -
  1. - Get started by editing{" "} - - src/app/page.tsx - - . -
  2. -
  3. - Save and see your changes instantly. -
  4. -
- -
- - Vercel logomark - Deploy now - - - Read our docs - -
-
- -
- ); + return
Hello, world!
; } diff --git a/sh/log.sh b/sh/log.sh index ac2bf93..a7be0b3 100644 --- a/sh/log.sh +++ b/sh/log.sh @@ -47,6 +47,8 @@ if [ "$FOLLOW" = true ]; then FOLLOW_FLAG="-f" fi +trap 'echo -e "${YELLOW}Log viewing interrupted by user.${NC}"; exit 0' SIGINT + echo -e "${GREEN}Connecting to ${TARGET_HOST} to view logs...${NC}" # Connect to the remote server and display logs diff --git a/sh/prod.sh b/sh/prod.sh index 3130d25..53a7b93 100755 --- a/sh/prod.sh +++ b/sh/prod.sh @@ -151,4 +151,12 @@ rm -rf "${TEMP_DIR}" || handle_error "Failed to clean up local temporary files" echo -e "${GREEN}Deployment process completed!${NC}" # Automatically tail logs after deployment echo -e "${GREEN}Tailing logs...${NC}" -sh "$(dirname "$0")/log.sh" -f \ No newline at end of file +sh "$(dirname "$0")/log.sh" -f +LOG_EXIT_CODE=$? +if [ $LOG_EXIT_CODE -eq 130 ]; then + echo -e "${YELLOW}Log viewing interrupted by user.${NC}" +else + if [ $LOG_EXIT_CODE -ne 0 ]; then + handle_error "Log viewing failed with exit code $LOG_EXIT_CODE" + fi +fi \ No newline at end of file