Merge pull request #10 from smolgrrr/docker

working docker build
This commit is contained in:
smolgrrr 2023-11-17 23:44:51 +11:00 committed by GitHub
commit f7f4fd1278
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 65 additions and 14 deletions

8
client/.dockerignore Normal file
View File

@ -0,0 +1,8 @@
Dockerfile
.dockerignore
node_modules
npm-debug.log
README.md
.next
.git
build

1
client/.gitignore vendored
View File

@ -1,4 +1,5 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
package-lock.json
# dependencies
/node_modules

21
client/Dockerfile Normal file
View File

@ -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;"]

View File

@ -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"
// ]
// }