Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: dockerizes the application issue#1629 #1630

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*.md
dist
.git
.vscode
.dockerignore
.gitignore
.env
config
build
node_modules
docker-compose.yaml
Dockerfile
17 changes: 16 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
17 changes: 12 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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'

8 changes: 8 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,12 @@ export default defineConfig({
environment: 'jsdom',
setupFiles: './tests/setup.js',
},
server: {
watch: {
usePolling: true,
},
host: true,
strictPort: true,
port: 5173,
}
})