├── .editorconfig ├── README.md ├── nextjs ├── Dockerfile └── README.md ├── remix ├── Dockerfile └── README.md └── vite ├── Dockerfile.nginx ├── Dockerfile.serve └── README.md /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_size = 2 5 | insert_final_newline = true 6 | trim_trailing_whitespace = true 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | refine logo 4 | 5 |
6 | 7 |
8 | 9 |
10 | Home Page | 11 | Discord | 12 | Examples | 13 | Blog | 14 | Documentation 15 | 16 |
17 |
18 | 19 | [![Discord](https://img.shields.io/discord/837692625737613362.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/refine) 20 | [![Twitter Follow](https://img.shields.io/twitter/follow/refine_dev?style=social)](https://twitter.com/refine_dev) 21 | 22 | refine - 100% open source React framework to build web apps 3x faster | Product Hunt 23 | 24 |
25 | 26 |
27 | 28 |
refine is an open-source, headless React framework for developers building enterprise internal tools, admin panels, dashboards, B2B applications. 29 | 30 |
31 | 32 | It eliminates repetitive tasks in CRUD operations and provides industry-standard solutions for critical project components like **authentication**, **access control**, **routing**, **networking**, **state management**, and **i18n**. 33 | 34 |
35 | 36 | # Refine Dockerfiles 37 | 38 | Here you can find example Refine Dockerfiles for `nextjs`, `remix` and `vite` projects. 39 | 40 | Navigate to each folder to see the Dockerfile and their README's. 41 | 42 | These Dockerfiles uses [Docker's multi-stage build best practices](https://docs.docker.com/develop/develop-images/dockerfile_best-practices) for security and optimizing image sizes. 43 | 44 | Final image runs application with `non-root` user and only includes production artifacts. 45 | 46 | ## Usage 47 | 48 | ### NextJS 49 | 50 | In your project root: 51 | 52 | ```bash 53 | docker build -t nextjs -f ./Dockerfile . 54 | 55 | docker run -p 3000:3000 nextjs 56 | ``` 57 | 58 | ### Remix 59 | 60 | In your project root: 61 | 62 | ```bash 63 | docker build -t remix -f ./Dockerfile . 64 | 65 | docker run -p 3000:3000 remix 66 | ``` 67 | 68 | ### Vite 69 | 70 | In your project root: 71 | 72 | ```bash 73 | docker build -t vite -f ./Dockerfile.nginx . 74 | 75 | docker run -p 5173:80 vite 76 | 77 | # or 78 | 79 | docker build -t vite -f ./Dockerfile.serve . 80 | 81 | docker run -p 5173:3000 vite 82 | ``` 83 | 84 | ## Documentation 85 | 86 | - [Refer to documentation for more info about refine](https://refine.dev/docs/). 87 | - [Step up to refine tutorials](https://refine.dev/docs/tutorial/introduction/index/). 88 | -------------------------------------------------------------------------------- /nextjs/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM refinedev/node:18 AS base 2 | 3 | FROM base AS deps 4 | 5 | RUN apk add --no-cache libc6-compat 6 | 7 | COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./ 8 | 9 | RUN \ 10 | if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ 11 | elif [ -f package-lock.json ]; then npm ci; \ 12 | elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \ 13 | else echo "Lockfile not found." && exit 1; \ 14 | fi 15 | 16 | FROM base AS builder 17 | 18 | COPY --from=deps /app/refine/node_modules ./node_modules 19 | 20 | COPY . . 21 | 22 | RUN npm run build 23 | 24 | FROM base AS runner 25 | 26 | ENV NODE_ENV production 27 | 28 | COPY --from=builder /app/refine/public ./public 29 | 30 | RUN mkdir .next 31 | RUN chown refine:nodejs .next 32 | 33 | COPY --from=builder --chown=refine:nodejs /app/refine/.next/standalone ./ 34 | COPY --from=builder --chown=refine:nodejs /app/refine/.next/static ./.next/static 35 | 36 | USER refine 37 | 38 | EXPOSE 3000 39 | 40 | ENV PORT 3000 41 | ENV HOSTNAME "0.0.0.0" 42 | 43 | CMD ["node", "server.js"] 44 | -------------------------------------------------------------------------------- /nextjs/README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | refine logo 4 | 5 |
6 | 7 |
8 | 9 |
10 | Home Page | 11 | Discord | 12 | Examples | 13 | Blog | 14 | Documentation 15 | 16 |
17 |
18 | 19 | [![Discord](https://img.shields.io/discord/837692625737613362.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/refine) 20 | [![Twitter Follow](https://img.shields.io/twitter/follow/refine_dev?style=social)](https://twitter.com/refine_dev) 21 | 22 | refine - 100% open source React framework to build web apps 3x faster | Product Hunt 23 | 24 |
25 | 26 |
27 | 28 |
refine is an open-source, headless React framework for developers building enterprise internal tools, admin panels, dashboards, B2B applications. 29 | 30 |
31 | 32 | It eliminates repetitive tasks in CRUD operations and provides industry-standard solutions for critical project components like **authentication**, **access control**, **routing**, **networking**, **state management**, and **i18n**. 33 | 34 |
35 | 36 | # NextJS Dockerfile 37 | 38 | Next.js build command doesn't export static files by default, so we need to add `output: "standalone"` to `next.config.js` file. 39 | 40 | This will create a `.next/standalone` folder at build step, which Dockerfile will use to serve the image. 41 | 42 | See [NextJS docs](https://nextjs.org/docs/pages/api-reference/next-config-js/output#automatically-copying-traced-files) for more info. 43 | 44 | ## Usage 45 | 46 | In your project root: 47 | 48 | ```bash 49 | docker build -t nextjs -f Dockerfile . 50 | 51 | docker run -p 3000:3000 nextjs 52 | ``` 53 | 54 | ## Documentation 55 | 56 | - [Refer to documentation for more info about refine](https://refine.dev/docs/). 57 | - [Step up to refine tutorials](https://refine.dev/docs/tutorial/introduction/index/). 58 | -------------------------------------------------------------------------------- /remix/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM refinedev/node:18 AS base 2 | 3 | FROM base as deps 4 | 5 | COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./ 6 | 7 | RUN \ 8 | if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ 9 | elif [ -f package-lock.json ]; then npm ci; \ 10 | elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \ 11 | else echo "Lockfile not found." && exit 1; \ 12 | fi 13 | 14 | FROM base as builder 15 | 16 | COPY --from=deps /app/refine/node_modules ./node_modules 17 | 18 | COPY . . 19 | 20 | RUN npm run build 21 | 22 | FROM base as production-deps 23 | 24 | COPY --from=deps /app/refine/node_modules ./node_modules 25 | 26 | COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./ 27 | 28 | ENV NODE_ENV production 29 | 30 | RUN npm prune 31 | 32 | FROM base AS runner 33 | 34 | ENV NODE_ENV production 35 | 36 | COPY --from=production-deps --chown=refine:nodejs /app/refine/node_modules ./node_modules 37 | COPY --from=builder --chown=refine:nodejs /app/refine/build ./build 38 | COPY --from=builder --chown=refine:nodejs /app/refine/public ./public 39 | COPY --from=builder --chown=refine:nodejs /app/refine/package.json ./package.json 40 | 41 | USER refine 42 | 43 | CMD ["npm", "run", "start"] 44 | -------------------------------------------------------------------------------- /remix/README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | refine logo 4 | 5 |
6 | 7 |
8 | 9 |
10 | Home Page | 11 | Discord | 12 | Examples | 13 | Blog | 14 | Documentation 15 | 16 |
17 |
18 | 19 | [![Discord](https://img.shields.io/discord/837692625737613362.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/refine) 20 | [![Twitter Follow](https://img.shields.io/twitter/follow/refine_dev?style=social)](https://twitter.com/refine_dev) 21 | 22 | refine - 100% open source React framework to build web apps 3x faster | Product Hunt 23 | 24 |
25 | 26 |
27 | 28 |
refine is an open-source, headless React framework for developers building enterprise internal tools, admin panels, dashboards, B2B applications. 29 | 30 |
31 | 32 | It eliminates repetitive tasks in CRUD operations and provides industry-standard solutions for critical project components like **authentication**, **access control**, **routing**, **networking**, **state management**, and **i18n**. 33 | 34 |
35 | 36 | # Remix Dockerfile 37 | 38 | ## Usage 39 | 40 | In your project root: 41 | 42 | ```bash 43 | docker build -t remix -f Dockerfile . 44 | 45 | docker run -p 3000:3000 remix 46 | ``` 47 | 48 | ## Documentation 49 | 50 | - [Refer to documentation for more info about refine](https://refine.dev/docs/). 51 | - [Step up to refine tutorials](https://refine.dev/docs/tutorial/introduction/index/). 52 | -------------------------------------------------------------------------------- /vite/Dockerfile.nginx: -------------------------------------------------------------------------------- 1 | FROM refinedev/node:18 AS base 2 | 3 | FROM base as deps 4 | 5 | COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./ 6 | 7 | RUN \ 8 | if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ 9 | elif [ -f package-lock.json ]; then npm ci; \ 10 | elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \ 11 | else echo "Lockfile not found." && exit 1; \ 12 | fi 13 | 14 | FROM base as builder 15 | 16 | ENV NODE_ENV production 17 | 18 | COPY --from=deps /app/refine/node_modules ./node_modules 19 | 20 | COPY . . 21 | 22 | RUN npm run build 23 | 24 | FROM nginx:1.21.3-alpine as runner 25 | 26 | ENV NODE_ENV production 27 | 28 | COPY --from=builder /app/refine/dist /usr/share/nginx/html 29 | 30 | RUN touch /etc/nginx/conf.d/default.conf 31 | 32 | RUN <> /etc/nginx/conf.d/default.conf 34 | echo " listen 80;" >> /etc/nginx/conf.d/default.conf 35 | echo "" >> /etc/nginx/conf.d/default.conf 36 | echo " gzip on;" >> /etc/nginx/conf.d/default.conf 37 | echo " gzip_proxied any;" >> /etc/nginx/conf.d/default.conf 38 | echo " gzip_comp_level 6;" >> /etc/nginx/conf.d/default.conf 39 | echo " gzip_buffers 16 8k;" >> /etc/nginx/conf.d/default.conf 40 | echo " gzip_http_version 1.1;" >> /etc/nginx/conf.d/default.conf 41 | echo " gzip_types text/css application/javascript application/json application/font-woff application/font-tff image/gif image/png image/svg+xml application/octet-stream;" >> /etc/nginx/conf.d/default.conf 42 | echo " gzip_vary on;" >> /etc/nginx/conf.d/default.conf 43 | echo "" >> /etc/nginx/conf.d/default.conf 44 | echo " location / {" >> /etc/nginx/conf.d/default.conf 45 | echo " root /usr/share/nginx/html;" >> /etc/nginx/conf.d/default.conf 46 | echo " index index.html index.htm;" >> /etc/nginx/conf.d/default.conf 47 | echo " try_files $uri /index.html =404;" >> /etc/nginx/conf.d/default.conf 48 | echo " }" >> /etc/nginx/conf.d/default.conf 49 | echo "" >> /etc/nginx/conf.d/default.conf 50 | echo " error_page 500 502 503 504 /50x.html;" >> /etc/nginx/conf.d/default.conf 51 | echo "" >> /etc/nginx/conf.d/default.conf 52 | echo " location = /50x.html {" >> /etc/nginx/conf.d/default.conf 53 | echo " root /usr/share/nginx/html;" >> /etc/nginx/conf.d/default.conf 54 | echo " }" >> /etc/nginx/conf.d/default.conf 55 | echo "}" >> /etc/nginx/conf.d/default.conf 56 | EOF 57 | 58 | CMD ["nginx", "-g", "daemon off;"] 59 | -------------------------------------------------------------------------------- /vite/Dockerfile.serve: -------------------------------------------------------------------------------- 1 | FROM refinedev/node:18 AS base 2 | 3 | FROM base as deps 4 | 5 | COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./ 6 | 7 | RUN \ 8 | if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ 9 | elif [ -f package-lock.json ]; then npm ci; \ 10 | elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \ 11 | else echo "Lockfile not found." && exit 1; \ 12 | fi 13 | 14 | FROM base as builder 15 | 16 | ENV NODE_ENV production 17 | 18 | COPY --from=deps /app/refine/node_modules ./node_modules 19 | 20 | COPY . . 21 | 22 | RUN npm run build 23 | 24 | FROM base as runner 25 | 26 | ENV NODE_ENV production 27 | 28 | RUN npm install -g serve 29 | 30 | COPY --from=builder /app/refine/dist ./ 31 | 32 | USER refine 33 | 34 | CMD ["serve"] 35 | -------------------------------------------------------------------------------- /vite/README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | refine logo 4 | 5 |
6 | 7 |
8 | 9 |
10 | Home Page | 11 | Discord | 12 | Examples | 13 | Blog | 14 | Documentation 15 | 16 |
17 |
18 | 19 | [![Discord](https://img.shields.io/discord/837692625737613362.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/refine) 20 | [![Twitter Follow](https://img.shields.io/twitter/follow/refine_dev?style=social)](https://twitter.com/refine_dev) 21 | 22 | refine - 100% open source React framework to build web apps 3x faster | Product Hunt 23 | 24 |
25 | 26 |
27 | 28 |
refine is an open-source, headless React framework for developers building enterprise internal tools, admin panels, dashboards, B2B applications. 29 | 30 |
31 | 32 | It eliminates repetitive tasks in CRUD operations and provides industry-standard solutions for critical project components like **authentication**, **access control**, **routing**, **networking**, **state management**, and **i18n**. 33 | 34 |
35 | 36 | # Vite Dockerfile 37 | 38 | Vite build command exports static files to `dist` folder. We can use any static file server to serve these files. 39 | 40 | We have 2 examples: 41 | 42 | - `Dockerfile.serve`: Uses `serve` package. https://www.npmjs.com/package/serve 43 | - `Dockerfile.nginx`: Uses nginx with Gzip config for better performance. 44 | 45 | ## Usage 46 | 47 | In your project root: 48 | 49 | ```bash 50 | docker build -t vite -f ./Dockerfile.nginx . 51 | 52 | docker run -p 5173:80 vite 53 | 54 | # or 55 | 56 | docker build -t vite -f ./Dockerfile.serve . 57 | 58 | docker run -p 5173:3000 vite 59 | ``` 60 | 61 | ## Documentation 62 | 63 | - [Refer to documentation for more info about refine](https://refine.dev/docs/). 64 | - [Step up to refine tutorials](https://refine.dev/docs/tutorial/introduction/index/). 65 | --------------------------------------------------------------------------------