diff --git a/Dockerfile b/Dockerfile index 3feaa5b..e72c387 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1 +1,16 @@ -# ADD DOCKERFILE CONTENTS HERE \ No newline at end of file +FROM node:18 AS builder + +WORKDIR /app +COPY package*.json ./ +RUN npm install +COPY . . +RUN npm run build + +FROM nginx:alpine + +COPY nginx.conf /etc/nginx/conf.d/default.conf +COPY --from=builder /app/build /usr/share/nginx/html + +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] diff --git a/ReactJS_Project.zip b/ReactJS_Project.zip new file mode 100644 index 0000000..9adbe97 Binary files /dev/null and b/ReactJS_Project.zip differ diff --git a/docker-compose.yml b/docker-compose.yml index dea1383..51fd9ba 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1 +1,9 @@ -# ADD DOCKER-COMPOSE CONTENTS HERE \ No newline at end of file +version: "3.9" + +services: + react-frontend: + build: . + container_name: react_frontend + ports: + - "8080:80" + restart: unless-stopped diff --git a/nginx.conf b/nginx.conf index c871570..8032709 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1 +1,11 @@ -# ADD NGINX CONTENTS HERE \ No newline at end of file +server { + listen 80; + server_name localhost; + + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri /index.html; + } +}