From 13be720500cde697b73ddba1933020003239657d Mon Sep 17 00:00:00 2001 From: Pouria Dianati <137393369+Pouriadia@users.noreply.github.com> Date: Sun, 2 Nov 2025 21:14:19 +0330 Subject: [PATCH] Added Dockerfile, Docker compose, and NGINX config files --- Dockerfile | 18 +++++++++++++++++- docker-compose.yml | 8 +++++++- nginx.conf | 11 ++++++++++- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3feaa5b..d885480 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1 +1,17 @@ -# ADD DOCKERFILE CONTENTS HERE \ No newline at end of file +# Building the react app +FROM node:22-alpine as build +WORKDIR /app + +# Installing dependencies first +COPY package.json package-lock.json . +RUN npm ci + +# Copy the rest of the app +COPY . . +RUN npm run build + +# Production +FROM nginx:alpine as prod +COPY --from=build /app/build /usr/share/nginx/html +COPY nginx.conf /etc/nginx/conf.d/default.conf +EXPOSE 80 diff --git a/docker-compose.yml b/docker-compose.yml index dea1383..35dbe6f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1 +1,7 @@ -# ADD DOCKER-COMPOSE CONTENTS HERE \ No newline at end of file +services: + web: + build: + context: . + target: prod + ports: + - "8080:80" diff --git a/nginx.conf b/nginx.conf index c871570..cb5bacc 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1 +1,10 @@ -# ADD NGINX CONTENTS HERE \ No newline at end of file +server { + error_log /var/log/nginx/error.log; + access_log /var/log/nginx/access.log; + listen 80; + location / { + root /usr/share/nginx/html; + index index.html; + try_files $uri $uri/ /index.html; + } +}