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

Added Dockerfile #245

Merged
merged 3 commits into from
Jun 6, 2024
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
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,53 @@ Check the design in [Figma](https://www.figma.com/design/WQnt0qRFSdaV3jW5XF8NSc/
<hr>

## 🛠️ Getting Started

### With Docker
1. **Clone the repository**

```sh
git clone https://github.com/Satyam1923/Spring.git
```

### For Backend
1. **Navigate to the backend folder**
```sh
cd backend
```
2. **Build Docker Image**
```sh
docker build -t <Image name>:<tag> .
```
3. **Run Docker Image**
```sh
docker run -p 3030:3030 <Image name>:<tag>
```
4. **Access it locally**

Go to http://localhost:3030/


### For Frontend
1. **Navigate to the frontend folder**

```sh
cd frontend
```
2. **Build Docker Image**
```sh
docker build -t <Image name>:<tag> .
```
3. **Run Docker Image**
```sh
docker run -p 3000:3000 <Image name>:<tag>
```
4. **Access it locally**

Go to http://localhost:3000/


### Without Docker

1. **Clone the repository**

```sh
Expand Down
2 changes: 2 additions & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
13 changes: 13 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:16-alpine

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . .

EXPOSE 3030

CMD ["npm", "start"]
2 changes: 2 additions & 0 deletions frontend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
15 changes: 15 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:16-alpine

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . .

RUN npm run build

EXPOSE 3000

CMD ["npm", "run", "preview"]
5 changes: 5 additions & 0 deletions frontend/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@ import react from "@vitejs/plugin-react";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],

preview: {
host: true,
port: 3000
}
});
Loading