Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

211
Visualizações
Hot-Reload in React using Docker

I have 2 docker containers running, one for an API and one for the front-end (build with React) of the application. I would like the front-end container to be updated whenever I make a change. The API container does not have to be updated on change.

doker-compose.yml:

services:
  api:
    build:
      context: .
      dockerfile: Dockerfile.api
    image: controle-app-api

  client:
    build:
      context: .
      dockerfile: Dockerfile.client
    image: controle-app-client
    volumes:
      - ./:/app
    ports:
      - "3000:3000"
    environment:
      CHOKIDAR_USEPOLLING: "true"

Dockerfile.client:

# Build step #1: build the React front end
FROM node:16-alpine as build-step

# Specify where our app will live in the container
WORKDIR /app

ENV PATH /app/node_modules/.bin:$PATH

# Copy the React App to the container
COPY package.json package-lock.json ./
COPY ./src ./src
COPY ./public ./public

# Prepare the container for building React
RUN npm install
RUN npm install react-scripts@3.0.1 -g
# We want the production version
RUN npm run build

# Prepare nginx
FROM nginx:stable-alpine
COPY --from=build-step /app/build /usr/share/nginx/html
COPY deployment/nginx.default.conf /etc/nginx/conf.d/default.conf

I tried applying the answer given at How to Hot-Reload in ReactJS Docker, but this did not help. Whenever I edit something in a .JS file, it is not updated on reload of the application.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda