From 293222aaba8cfe5abf3a7838afc0ebf0181ff8c2 Mon Sep 17 00:00:00 2001 From: Eugene Fox Date: Sun, 18 Feb 2024 19:40:41 +0000 Subject: [PATCH] - Added Dockerfile - Fixed ESLint error --- .dockerignore | 4 ++++ Dockerfile | 26 ++++++++++++++++++++++++++ src/main.tsx | 1 - 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..f59c83c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +dist/ +node_modules/ +.devcontainer/ +.github/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b6f3733 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +# Use the official Node.js 20 image as the base image +FROM node:20 as builder + +# Set the working directory inside the container +WORKDIR /app + +# Copy the package.json and package-lock.json files to the working directory +COPY package*.json ./ + +# Install the app dependencies +RUN yarn install + +# Copy the app source code to the working directory +COPY . . + +# Build the app +RUN yarn build + +# Use the official Nginx image as the base image +FROM nginx:latest as prod + +# Copy the build output to replace the default Nginx contents +COPY --from=builder /app/dist /usr/share/nginx/html + +# Expose port 80 +CMD ["nginx", "-g", "daemon off;"] diff --git a/src/main.tsx b/src/main.tsx index 2f699c9..6d0ba79 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -2,7 +2,6 @@ import React from "react"; import ReactDOM from "react-dom/client"; import App from "./App"; -// eslint-disable-next-line @typescript-eslint/no-non-null-assertion ReactDOM.createRoot(document.getElementById("root")!).render(