continuing-cyan
continuing-cyan12mo 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.ai12mo 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.ai12mo 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.ai12mo ago
<@523155468466520065> kapa.ai is still learning and improving, please let us how it did by reacting below
flat-fuchsia
flat-fuchsia12mo 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.
continuing-cyan
continuing-cyan12mo ago
thanks I search some examples from google but I can't create healthy image
Omer
Omer12mo 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
continuing-cyan
continuing-cyan12mo ago
yay! thanks
Omer
Omer12mo ago
You're welcome. Is everything okay with refine? :p
continuing-cyan
continuing-cyan12mo ago
yep all things is okey very compact 🙂
continuing-cyan
continuing-cyan12mo ago
but I got this error from docker run
No description
continuing-cyan
continuing-cyan12mo 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 🙂
foreign-sapphire
foreign-sapphire12mo 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.
continuing-cyan
continuing-cyan12mo ago
Thanks I will be happy to contribute if you tell me which part I need to add
foreign-sapphire
foreign-sapphire12mo ago
You can add a section under Advanced Tutorials with title Dockerfile or Deployment https://refine.dev/docs/advanced-tutorials/
foreign-sapphire
foreign-sapphire12mo 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.