Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1,24 @@
# ADD DOCKERFILE CONTENTS HERE

FROM node:18-alpine AS build

WORKDIR /app

COPY package*.json ./

RUN npm ci --silent

COPY . .

RUN npm run build

FROM nginx:alpine

RUN rm -rf /etc/nginx/conf.d/*

COPY nginx.conf /etc/nginx/conf.d/default.conf

COPY --from=build /app/build /usr/share/nginx/html

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
13 changes: 12 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
# ADD DOCKER-COMPOSE CONTENTS HERE
# ADD DOCKER-COMPOSE CONTENTS HERE
version: "3.8"

services:
react-app:
build:
context: .
dockerfile: Dockerfile
container_name: react_app
ports:
- "3000:80"
restart: unless-stopped
16 changes: 15 additions & 1 deletion nginx.conf
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
# ADD NGINX CONTENTS HERE
# ADD NGINX CONTENTS HERE
server {
listen 80;
server_name _;

root /usr/share/nginx/html;
index index.html index.htm;

location / {
try_files $uri $uri/ /index.html;
}

add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
}