diff --git a/client/Dockerfile b/client/Dockerfile index 9f2a70d4b02313cc3169c1b14a31b41276ca525c..cccc489a054978e3e1022c349a8a8827a1c3b523 100644 --- a/client/Dockerfile +++ b/client/Dockerfile @@ -1,8 +1,8 @@ -FROM node:18-alpine +FROM node:18-alpine AS build WORKDIR /app -COPY package.json . +COPY package.json package-lock.json ./ RUN npm install @@ -10,6 +10,12 @@ COPY . . RUN npm run build -EXPOSE 8080 +FROM nginx:alpine -CMD [ "npm", "run", "preview" ] \ No newline at end of file +COPY --from=build /app/dist /usr/share/nginx/html + +COPY nginx.conf /etc/nginx/nginx.conf + +EXPOSE 4200 + +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/client/nginx.conf b/client/nginx.conf new file mode 100644 index 0000000000000000000000000000000000000000..59ed87c13ae13e5d21fe314e1fbc2759fe9c4db4 --- /dev/null +++ b/client/nginx.conf @@ -0,0 +1,25 @@ +# nginx.conf + +events {} + +http { + server { + listen 4200; + server_name localhost; + + root /usr/share/nginx/html; + index index.html; + + types { + text/html html; + application/javascript js; + text/css css; + image/png png; + image/jpeg jpg; + } + + location / { + try_files $uri $uri/ /index.html; + } + } +} \ No newline at end of file diff --git a/client/src/services/Api/Api.ts b/client/src/services/Api/Api.ts index f6c6874b39e736c2b476df36d03bb368451a1baa..2b25581fbc40e86d910a74eab1542ebd2f98cd00 100644 --- a/client/src/services/Api/Api.ts +++ b/client/src/services/Api/Api.ts @@ -1,5 +1,5 @@ import axios from 'axios'; -import { redirect } from 'react-router-dom'; +// import { redirect } from 'react-router-dom'; export interface IFact { fact: string; diff --git a/docker-compose.yaml b/docker-compose.yaml index 36dcf8ab79eecf19e23566edab30e9064defc97d..1c0d48331a0bc4b3c0ff69256323c11c977e9129 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -6,7 +6,7 @@ services: context: client dockerfile: ./Dockerfile ports: - - 8080-8080 + - 4200-4200 networks: - airline-net # End React UI Client