Horrible Howto - Dockerize Create React App

So, for a long time, I got really mad at not being able to dockerize create-react-app....but I finally figured it out. Make sure you install the server app that comes included with create-react-app:

FROM node:boron

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
COPY package.json .
COPY package-lock.json .
# For npm@5 or later, copy package-lock.json as well
# COPY package.json package-lock.json .

RUN npm install

# Bundle app source
COPY . /usr/src/app

RUN npm run build

CMD [ "npm", "run", "serve:build" ]
Show Comments

Get the latest posts delivered right to your inbox.