I’m trying to build a docker container that installs react and its dependencies and then replicates those installations on my machine, so I don’t have to install the dependencies every time I want to create an application. But for some reason I’m not able to perform this "automatic" creation.. Can anyone help me, please?
PS: the react file structure is being created in the container, but not being replicated in my machine.
My Dockerfile:
FROM node:20.1.0 AS builder
WORKDIR /app
COPY package*.json ./
RUN npm install
RUN npx create-react-app react-app
FROM node:20.1.0
WORKDIR /app/react-app
COPY --from=builder /app/react-app .
COPY . .
EXPOSE 3000
compose.yaml
version: "3.8"
services:
app-dev:
build:
context: .
dockerfile: Dockerfile.dev
ports:
- "3000:3000"
volumes:
- .:/app
- /app/node_modules