wise-white
wise-white•15mo ago

Dockerfile Config for Production

Hello, I wonder if there is a dockerfile example so that I can deploy my Refine project in production.
15 Replies
kapa.ai
kapa.ai•15mo ago
Hi @muratmirgun. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
kapa.ai
kapa.ai•15mo ago
---------------------- Hmm, I don't know enough to give you a confident answer yet. However, you can check out the Refine documentation and blog for more information: - Refine Documentation: https://refine.dev/docs - Refine Blog: https://refine.dev/blog ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
Overview | refine
What is refine?
Blog | refine
A Docusaurus powered blog!
kapa.ai
kapa.ai•15mo ago
<@523155468466520065> kapa.ai is still learning and improving, please let us how it did by reacting below
fascinating-indigo
fascinating-indigo•15mo ago
Hey @muratmirgun Unfortunately no. I don't think there will be a special case for refine for dockerfile. It will not be different from Nextjs or CRA.
wise-white
wise-white•15mo ago
thanks I search some examples from google but I can't create healthy image
Omer
Omer•15mo ago
Here's an example for you!
FROM node:18-alpine

WORKDIR /opt/app

COPY package*.json ./
COPY .npmrc ./

RUN npm ci

COPY . /opt/app

RUN npm run build

FROM node:18-alpine

COPY --from=0 /opt/app/build /opt/app
WORKDIR /opt/app/

ENV NODE_ENV=production

RUN npm install -g serve

CMD serve -l 5000
FROM node:18-alpine

WORKDIR /opt/app

COPY package*.json ./
COPY .npmrc ./

RUN npm ci

COPY . /opt/app

RUN npm run build

FROM node:18-alpine

COPY --from=0 /opt/app/build /opt/app
WORKDIR /opt/app/

ENV NODE_ENV=production

RUN npm install -g serve

CMD serve -l 5000
vite example: https://plainenglish.io/blog/step-by-step-guide-to-dockerize-react-app-created-using-vite
wise-white
wise-white•15mo ago
yay! thanks
Omer
Omer•15mo ago
You're welcome. Is everything okay with refine? :p
wise-white
wise-white•15mo ago
yep all things is okey very compact 🙂
wise-white
wise-white•15mo ago
but I got this error from docker run
No description
wise-white
wise-white•15mo ago
@Omer
FROM node:18-alpine

WORKDIR /opt/app

COPY package*.json ./
COPY package.json ./
COPY .npmrc ./


RUN npm install

RUN npm ci

COPY . /opt/app

RUN npm run-script refine build

FROM node:18-alpine

COPY --from=0 /opt/app/build /opt/app/build
WORKDIR /opt/app/

ENV NODE_ENV=production

RUN npm install -g serve


CMD serve -s build
FROM node:18-alpine

WORKDIR /opt/app

COPY package*.json ./
COPY package.json ./
COPY .npmrc ./


RUN npm install

RUN npm ci

COPY . /opt/app

RUN npm run-script refine build

FROM node:18-alpine

COPY --from=0 /opt/app/build /opt/app/build
WORKDIR /opt/app/

ENV NODE_ENV=production

RUN npm install -g serve


CMD serve -s build
I made some modifications you can give this example for other guys like me 🙂
correct-apricot
correct-apricot•15mo ago
Hey @muratmirgun , we are happy your issue resolved, and thanks for your contribution, we'll update our documentation to include example Dockerfile's soon! You can also feel free to create a PR.
wise-white
wise-white•15mo ago
Thanks I will be happy to contribute if you tell me which part I need to add
correct-apricot
correct-apricot•15mo ago
You can add a section under Advanced Tutorials with title Dockerfile or Deployment https://refine.dev/docs/advanced-tutorials/
correct-apricot
correct-apricot•15mo ago
You can check our contribution guide here: https://refine.dev/docs/contributing/
Contributing | refine
We follow a code of conduct when participating in the community. Please read it before you make any contributions.