diff --git a/Dockerfile b/Dockerfile index 3feaa5b..1c5f28d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1 +1,12 @@ -# ADD DOCKERFILE CONTENTS HERE \ No newline at end of file +# ADD DOCKERFILE CONTENTS HERE +FROM node:20-alpine + +WORKDIR /app + +COPY package*.json ./ + +RUN npm install + +COPY . . + +RUN npm run build diff --git a/docker-compose.yml b/docker-compose.yml index dea1383..e84a822 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1 +1,22 @@ -# ADD DOCKER-COMPOSE CONTENTS HERE \ No newline at end of file +# ADD DOCKER-COMPOSE CONTENTS HERE +version: "3.9" + +services: + react_build: + build: . + working_dir: /app + volumes: + - ./build:/app/build + command: > + sh -c "npm install && npm run build" + + nginx: + image: nginx:alpine + ports: + - "3000:80" + volumes: + - ./build:/usr/share/nginx/html + - ./nginx.conf:/etc/nginx/conf.d/default.conf + depends_on: + - react_build + diff --git a/nginx.conf b/nginx.conf index c871570..017a122 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1 +1,11 @@ -# ADD NGINX CONTENTS HERE \ No newline at end of file +# ADD NGINX CONTENTS HERE +server { + listen 80; + server_name localhost; + + root /usr/share/nginx/html; + + location / { + try_files $uri /index.html; + } +}