From b1fd32ecc60bca03fb198daea4687102b6aa21cd Mon Sep 17 00:00:00 2001 From: Saahil Date: Fri, 6 Sep 2024 22:41:03 -0400 Subject: [PATCH] feat: docker (#5) Co-authored-by: zeon-neon[bot] <136533918+zeon-neon[bot]@users.noreply.github.com> --- .dockerignore | 3 ++ .github/workflows/build-docker.yml | 22 ++++++++ Dockerfile | 14 +++++ docker-compose.yml | 7 +++ src/components/AboutPage/index.tsx | 83 ++++++++++++++---------------- 5 files changed, 86 insertions(+), 43 deletions(-) create mode 100644 .dockerignore create mode 100644 .github/workflows/build-docker.yml create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..994acf0c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +node_modules +.github +scripts diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml new file mode 100644 index 00000000..200be170 --- /dev/null +++ b/.github/workflows/build-docker.yml @@ -0,0 +1,22 @@ +name: publish +on: + push: + branches: + - "main" + workflow_dispatch: + +jobs: + publish-docker-image: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.MY_TOKEN }} + - name: Build the Docker image + run: | + docker build . --tag ghcr.io/neongamerbot-qk/saahildcom:latest + docker push ghcr.io/neongamerbot-qk/saahildcom:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..8ebeba0d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM node:20-alpine as builder +WORKDIR /app +COPY package*.json . +COPY yarn*.lock . +RUN yarn install +COPY . . +RUN yarn build + +#Stage 2 +FROM nginx:1.19.0 +WORKDIR /usr/share/nginx/html +RUN rm -rf ./* +COPY --from=builder /app/build . +ENTRYPOINT ["nginx", "-g", "daemon off;"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..b97fe6e9 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +name: +services: + : + ports: + - 3000:80 + container_name: saahildcom + image: :latest diff --git a/src/components/AboutPage/index.tsx b/src/components/AboutPage/index.tsx index 81892b3c..52cfc79f 100644 --- a/src/components/AboutPage/index.tsx +++ b/src/components/AboutPage/index.tsx @@ -1,52 +1,49 @@ -import { mdiBullet } from "@mdi/js"; -import Icon from "@mdi/react"; -import { useEffect, useState } from "react"; +import { mdiBullet } from '@mdi/js' +import Icon from '@mdi/react' +import { useEffect, useState } from 'react' -export default function AboutPage() { - const [currentGrade, setCurrentGrade] = useState("0th"); +export default function AboutPage () { + const [currentGrade, setCurrentGrade] = useState("0th") useEffect(() => { - let year: number = new Date().getFullYear(); + let year:number = new Date().getFullYear() if (year > 2027) { - let result = year - 2027; - switch (result) { - case 0: - setCurrentGrade(`12th`); - break; - default: - setCurrentGrade(`Collage Student`); - break; +let result = year - 2027 + switch(result) { +case 0: + setCurrentGrade(`12th`) + break; + default: +setCurrentGrade(`Collage Student`) + break; } } else { - setCurrentGrade(`${Math.abs(2027 - 2024 - 13)}th`); + setCurrentGrade(`${Math.abs((2027 - 2024) - 13)}th`) } - }); - return ( -
-
-

- Some info about me -

-
-
-

- Hi Everyone, I am{" "} - Saahil dutta, - from USA -
I am a {currentGrade} grader in KCD. -
-
- Apart from coding, some other activities that I love to do! -

-
    -
  • - {" "} - Playing Games -
  • -
  • - {" "} - Eating different types of food -
  • - {/*
  • + }) + return
    +
    +

    +Some info about me +

    +
    +
    +

    + Hi Everyone, I am{' '} + Saahil dutta, + from USA +
    I am a {currentGrade} grader in KCD. +
    +
    + Apart from coding, some other activities that I love to do! +

    +
      +
    • + Playing Games +
    • +
    • + Eating different types of food +
    • + {/*
    • Traveling
    • */}