updated frontend deployment yaml and added nginx config

updated frontend deployment yaml and added nginx config
This commit is contained in:
Benjamin Loh 2023-10-30 23:41:49 +08:00
parent 6237982d5c
commit dad2b6788b
4 changed files with 18 additions and 11 deletions

View File

@ -20,11 +20,6 @@ spec:
containers:
- name: safeshare-frontend
image: itsmexrando/safeshare-frontend:latest
imagePullPolicy: IfNotPresent
env:
- name: REACT_APP_API_HOST
value: safeshare-backend-service
- name: REACT_APP_API_PORT
value: "80"
imagePullPolicy: Always
ports:
- containerPort: 80

View File

@ -14,8 +14,8 @@ FROM nginx:alpine AS production-stage
# Copy the built app from the build stage
COPY --from=build-stage /frontend/build /usr/share/nginx/html
# Use a custom nginx.conf (optional but can be useful)
# COPY nginx.conf /etc/nginx/conf.d/default.conf
# Use a custom nginx.conf
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Expose port 80
EXPOSE 80

View File

@ -0,0 +1,15 @@
server {
listen 80;
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
}
location /api/ {
proxy_pass http://safeshare-backend-service:80;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

View File

@ -43,9 +43,6 @@ function ShareFile() {
const handleFileUpload = (file) => {
setFile(file);
//setPasscode('1234');
console.log(file);
console.log(apiUrl);
if (file) {
const formData = new FormData();
formData.append('file', file);