diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..38ea5b0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,34 @@ +# Ignore node modules +node_modules + +# Ignore build output +.next +out + +# Ignore local env files +.env +.env.local +.env.*.local + +# Ignore logs +npm-debug.log +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + +# Ignore Git +.git +.gitignore + +# Ignore Dockerfile itself? +Dockerfile + +# Ignore OS-specific files +.DS_Store + +# Ignore editor settings +.vscode +.idea + +# Ignore caches +.next/cache diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..085cd66 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM node:20-alpine AS builder +WORKDIR /app +COPY package*.json ./ +RUN npm install +COPY . . +RUN npm run build + +FROM node:20-alpine AS runner +WORKDIR /app +COPY --from=builder /app ./ +EXPOSE 3000 +CMD ["npm", "start"] \ No newline at end of file diff --git a/README.md b/README.md index d7e08ca..c46d82a 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,24 @@ You can start editing the page by modifying `app/(public)/page.js`. The page aut This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Outfit](https://vercel.com/font), a new font family for Vercel. +--- +## Docker + +You can run GoCart using Docker withou installing Node.js locally. + +#### Build the image +```bash +docker build -t gocart-app . +``` + +#### Run the container +```bash +docker run -d -p 3000:3000 gocart-app +``` + +#### Open in browser +Go to http://localhost:3000 to view the app. + --- ## 🤝 Contributing