equal-aqua
equal-aqua5mo ago

How to get live app updates during Dev time

Hi all, I finally decide to ask the question here after 2h of turning around without solution. I've got a docker-compose.yml to initiate multiple apps (wp, api, strapi, refin, db, ...) and a Dockerfile in my refine app directory. But I cannot find the way to work in a development mode with refine. needs : when I update a file, the app should be update as well instantly here is my dcoker-compose.yml for refine
refine_app:
#build: ./app/komunityApp
build: ./app/refine-project
#x-develop:
# watch:
# - action: rebuild
# path: ./app/refine-project
#command: sh -c "npm run build"
volumes:
#- ./app/komunityApp/app:/usr/src/app
- ./app/refine-project:/usr/src
- ./app/refine-project/app:/usr/src/app
networks:
- komunity_net
labels:
- "traefik.enable=true"
- "traefik.http.routers.refineapp.rule=Host(`app.kom-unity.me`)"
- "traefik.http.services.refineapp.loadbalancer.server.port=3000"
refine_app:
#build: ./app/komunityApp
build: ./app/refine-project
#x-develop:
# watch:
# - action: rebuild
# path: ./app/refine-project
#command: sh -c "npm run build"
volumes:
#- ./app/komunityApp/app:/usr/src/app
- ./app/refine-project:/usr/src
- ./app/refine-project/app:/usr/src/app
networks:
- komunity_net
labels:
- "traefik.enable=true"
- "traefik.http.routers.refineapp.rule=Host(`app.kom-unity.me`)"
- "traefik.http.services.refineapp.loadbalancer.server.port=3000"
here is my dockerfile
FROM refinedev/node:18 AS base

FROM base as deps

COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./

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

#FROM base as builder
FROM base as dev

#ENV NODE_ENV production
ENV NODE_ENV development

COPY --from=deps /app/refine/node_modules ./node_modules

COPY . .

RUN npm run dev --host=app.kom-unity.me
#RUN npm run build

#FROM base as runner

#ENV NODE_ENV production
#ENV NODE_ENV development

#RUN npm install -g serve

#COPY --from=builder /app/refine/dist ./

#USER refine

#CMD ["serve"]
FROM refinedev/node:18 AS base

FROM base as deps

COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./

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

#FROM base as builder
FROM base as dev

#ENV NODE_ENV production
ENV NODE_ENV development

COPY --from=deps /app/refine/node_modules ./node_modules

COPY . .

RUN npm run dev --host=app.kom-unity.me
#RUN npm run build

#FROM base as runner

#ENV NODE_ENV production
#ENV NODE_ENV development

#RUN npm install -g serve

#COPY --from=builder /app/refine/dist ./

#USER refine

#CMD ["serve"]
` Can someone could help me to pass this dificulty, if you please ?
2 Replies
kapa.ai
kapa.ai5mo ago
Hi @kom-unity.me. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hmm, I don't know enough to give you a confident answer yet. However, for development purposes with Refine, it's crucial to ensure that your development environment is set up correctly to allow for live updates when files are changed. This typically involves configuring your Docker setup to mount your project files into the container so that changes on your host machine are reflected inside the container, and ensuring that your development server within the container is running in a mode that watches for file changes. While the extracts provided do not directly address the specific setup for Docker with live reloading for Refine, they do offer some insights into working with Refine in a development environment. For instance, the usage of the refine CLI for development purposes is mentioned, suggesting that Refine provides tools to facilitate development workflows. Given the lack of direct information on Docker configurations for live updates with Refine, I recommend consulting the official Refine documentation or community resources for guidance on setting up your Docker environment for development with live reloading. The Refine documentation and community forums or Discord channels might offer more specific advice or examples of Docker configurations that support your needs. For general guidance on Refine development, you might find the following resources helpful: - Refine Documentation (https://refine.dev/docs/) - Refine GitHub Repository (https://github.com/refinedev/refine) for examples and issues - Refine Discord Community (https://discord.com/channels/837692625737613362) for asking questions and sharing experiences with other Refine users Remember, the key to achieving live updates during development typically involves correctly mounting your project files into the Docker container and using a development server that watches for file changes. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai5mo ago
<@1212249933571293295> kapa.ai is still learning and improving, please let us know how it did by reacting below