diff --git a/client/.dockerignore b/client/.dockerignore new file mode 100644 index 0000000..e3d77d6 --- /dev/null +++ b/client/.dockerignore @@ -0,0 +1,8 @@ +Dockerfile +.dockerignore +node_modules +npm-debug.log +README.md +.next +.git +build \ No newline at end of file diff --git a/client/.gitignore b/client/.gitignore index e0a1e06..f7fb300 100644 --- a/client/.gitignore +++ b/client/.gitignore @@ -1,4 +1,5 @@ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. +package-lock.json # dependencies /node_modules diff --git a/client/Dockerfile b/client/Dockerfile new file mode 100644 index 0000000..d98802f --- /dev/null +++ b/client/Dockerfile @@ -0,0 +1,21 @@ +# Stage 1: Building the React application +FROM node:18-alpine AS build +WORKDIR /app +COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./ +RUN \ + if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ + elif [ -f package-lock.json ]; then npm ci; \ + elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \ + else echo "Lockfile not found." && exit 1; \ + fi +COPY . . +RUN yarn build # or `npm run build` if using npm + +# Stage 2: Setting up Nginx to serve the React application +FROM nginx:alpine AS production +# Copy built assets from 'build' stage +COPY --from=build /app/build /usr/share/nginx/html +# Optional: If you have a custom nginx.conf, you can copy it to the container +# COPY nginx.conf /etc/nginx/nginx.conf +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] diff --git a/client/tsconfig.json b/client/tsconfig.json index ffe6f2c..c402614 100644 --- a/client/tsconfig.json +++ b/client/tsconfig.json @@ -1,27 +1,48 @@ { "compilerOptions": { "target": "es5", - "lib": [ - "dom", - "dom.iterable", - "esnext", - "webworker" - ], + "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, "strict": true, "forceConsistentCasingInFileNames": true, - "noFallthroughCasesInSwitch": true, + "noEmit": true, + "esModuleInterop": true, "module": "esnext", "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, - "noEmit": true, - "jsx": "react-jsx" + "jsx": "preserve", + "incremental": true }, - "include": [ - "src" - ] + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], + "exclude": ["node_modules"] } + +// { +// "compilerOptions": { +// "target": "es5", +// "lib": [ +// "dom", +// "dom.iterable", +// "esnext", +// "webworker" +// ], +// "allowJs": true, +// "skipLibCheck": true, +// "esModuleInterop": true, +// "allowSyntheticDefaultImports": true, +// "strict": true, +// "forceConsistentCasingInFileNames": true, +// "noFallthroughCasesInSwitch": true, +// "module": "esnext", +// "moduleResolution": "node", +// "resolveJsonModule": true, +// "isolatedModules": true, +// "noEmit": true, +// "jsx": "react-jsx" +// }, +// "include": [ +// "src" +// ] +// }