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
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
build
.env
.git
19 changes: 18 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
# ADD DOCKERFILE CONTENTS HERE
FROM node:18.17.1-alpine AS builder
WORKDIR /app

COPY package*.json ./
RUN npm install

COPY . .
RUN npm run build

FROM nginx:alpine
RUN rm -rf /usr/share/nginx/html/*

COPY --from=builder /app/build /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf

EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

8 changes: 7 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
# ADD DOCKER-COMPOSE CONTENTS HERE
services:
frontend:
build: .
container_name: react-frontend
ports:
- "80:80"
restart: unless-stopped
17 changes: 16 additions & 1 deletion nginx.conf
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
# ADD NGINX CONTENTS HERE
server {
listen 80;
server_name _;

root /usr/share/nginx/html;

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

location ~* \.(js|css|png|jpg|jpeg|gif|svg|ico)$ {
try_files $uri /index.html;
expires 30d;
add_header Cache-Control "public, no-transform";
}
}
Binary file added react-test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.