Skip to content

Commit 90f22ca

Browse files
committed
#48578 Security fixes + docker setup
1 parent d56353f commit 90f22ca

File tree

5 files changed

+653
-590
lines changed

5 files changed

+653
-590
lines changed

.dockerignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.env
2+
.env.local
3+
.env.development
4+
.env.production
5+
.env.test
6+
.env.test.local
7+
node_modules
8+
dist
9+
.vscode
10+
.idea

Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM node:22-alpine AS node
2+
3+
FROM node AS builder
4+
ARG VITE_API_URL
5+
WORKDIR /builder
6+
ENV NODE_ENV=production
7+
COPY . .
8+
9+
RUN npm install
10+
RUN npm run build
11+
12+
FROM nginx:alpine AS runner
13+
WORKDIR /app
14+
15+
# Create custom nginx.conf
16+
RUN echo $'\
17+
server {\n\
18+
listen 80;\n\
19+
location / {\n\
20+
root /usr/share/nginx/html;\n\
21+
index index.html;\n\
22+
try_files $uri $uri/ /index.html;\n\
23+
}\n\
24+
}' > /etc/nginx/conf.d/default.conf
25+
26+
COPY --from=builder /builder/dist /usr/share/nginx/html

README.md

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Project Overview
2-
This project is built using Vite and React.
2+
3+
This project is built using Vite and React.
34

45
# Deployed Radar Diagram
56

@@ -10,17 +11,47 @@ The radar is customizable. You can also add additional rings and divide the rada
1011
The radar uses the [radar-diagram](https://www.npmjs.com/package/radar-diagram) library.
1112

1213
## Prerequisitions:
13-
* nodejs v18
14+
15+
- nodejs v18
1416

1517
## Installation
1618

1719
1. To install all the necessary dependencies, run the following command:
1820

1921
`npm install`
2022

21-
2223
## Running the Project
24+
2325
2. To start the development server, use the following command:
2426

2527
`npm run dev`
2628

29+
## Production setup
30+
31+
1. Build project image
32+
33+
via package.json script
34+
35+
```sh
36+
npm run image:build
37+
```
38+
39+
or directly running docker
40+
41+
```sh
42+
docker build -t frontend-radar:latest .
43+
```
44+
45+
2. Run the production image
46+
47+
via package.json script, runs on port 8080
48+
49+
```sh
50+
npm run image:run
51+
```
52+
53+
or directly running docker
54+
55+
```sh
56+
docker run -p 8080:80 --rm frontend-radar:latest
57+
```

0 commit comments

Comments
 (0)