From c328110dd4e5bc1f8066cbd842ca349307386332 Mon Sep 17 00:00:00 2001 From: Bharath Kalyan S Date: Sat, 23 Sep 2023 13:27:51 +0530 Subject: [PATCH 1/3] fix: fixed to build docker image --- .dockerignore | 12 ++++++++++++ Dockerfile | 17 ++++++++++++----- vite.config.js | 8 ++++++++ 3 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..946f530f --- /dev/null +++ b/.dockerignore @@ -0,0 +1,12 @@ +*.md +dist +.git +.vscode +.dockerignore +.gitignore +.env +config +build +node_modules +docker-compose.yaml +Dockerfile \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index c344ae9c..93483944 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,20 @@ -FROM node:18 +#PULLING an ALPINE IMAGE (LESS IN SIZE) +FROM node:18-alpine +#INSTALLING PNPM +RUN npm i -g pnpm + +#CHANGING THE DIRECTORY WORKDIR /app -COPY package*.json ./ +#COPYING THE NECESSARY FILES +COPY package.json pnpm-lock.yaml ./ +#RUNNING PNPM INSTALL TO INSTALL THE DEPENDENCIES RUN pnpm install +#COPYING THE FILES TO THE APP DIRECTORY COPY . . -EXPOSE 5173 - -CMD ["pnpm", "start"] +#RUNNING THE APPLICATION INSIDE THE CONTAINER +CMD ["pnpm", "start"] \ No newline at end of file diff --git a/vite.config.js b/vite.config.js index f16e041c..3cad77f9 100644 --- a/vite.config.js +++ b/vite.config.js @@ -9,4 +9,12 @@ export default defineConfig({ environment: 'jsdom', setupFiles: './tests/setup.js', }, + server: { + watch: { + usePolling: true, + }, + host: true, + strictPort: true, + port: 5173, + } }) From e34fad2eee62b3d0cd69aa16f2af6bca0ade6cba Mon Sep 17 00:00:00 2001 From: Bharath Kalyan S Date: Sat, 23 Sep 2023 15:05:46 +0530 Subject: [PATCH 2/3] refactor: added docker compose file for hot reloading --- Dockerfile | 2 +- docker-compose.yml | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile index 93483944..54100ab5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ WORKDIR /app #COPYING THE NECESSARY FILES COPY package.json pnpm-lock.yaml ./ -#RUNNING PNPM INSTALL TO INSTALL THE DEPENDENCIES +#RUNNING `PNPM INSTALL` TO INSTALL THE DEPENDENCIES RUN pnpm install #COPYING THE FILES TO THE APP DIRECTORY diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..dfdd1907 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ +version: '3.8' +services: + app: + stdin_open: true + build: + context: . + dockerfile: Dockerfile + volumes: + - '.:/app' + - /app/node_modules + ports: + - 5173:5173 + environment: + CHOKIDAR_USEPOLLING: 'true' + From 19e2ff2fcc1dc38444985c431e7625d346b74cdb Mon Sep 17 00:00:00 2001 From: Bharath Kalyan S Date: Sat, 23 Sep 2023 15:16:30 +0530 Subject: [PATCH 3/3] docs: added instructions, how to start docker compose --- CONTRIBUTING.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 26eb3701..49d89079 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,7 +17,20 @@ git clone https://github.com/your-username/free-hit.git cd free-hit ``` -4. Open CMD in your current directory and install pnpm packages using command.[If pnpm is not installed, you can install it by clicking on this link to [pnpm](https://pnpm.io/installation)] +4. There are two ways to start your application + +- Using Docker Compose + - Docker must be installed and running before proceeding. + - This is the easiest way to start your application without downloading any dependencies that can alter your local versions. + - Below command builds the docker image and starts the container where our app will be running on `http://localhost:5173/` + +```markdown + docker compose up +``` + +- Normal Installation + + - Open CMD in your current directory and install pnpm packages using command.[If pnpm is not installed, you can install it by clicking on this link to [pnpm](https://pnpm.io/installation)] ```markdown pnpm i @@ -78,7 +91,9 @@ git push ``` 7. Create a new pull request from your forked repository (Click the `New Pull Request` button located at the top of your repo) + ### How to Create a PR + 1. After you push the changes you need to create a pull request and name the issue and mention the issue number, eg: chore: added tool #issuenumber 2. The tags which can be used for url submission are as follows: