Skip to content

Instantly share code, notes, and snippets.

@chochinlu
Last active December 23, 2020 02:31
Show Gist options
  • Save chochinlu/3e6bd70968f9f425149ac18ace37d595 to your computer and use it in GitHub Desktop.
Save chochinlu/3e6bd70968f9f425149ac18ace37d595 to your computer and use it in GitHub Desktop.
Create React App + Docker
.git
.gitignore
.idea
node_modules
build
# build environment
FROM node:current-alpine3.12 AS build
WORKDIR /usr/src/app
COPY package.json yarn.lock ./
# python 2 for node-gyp
RUN apk add --update --no-cache --virtual .gyp \
python2 \
make \
g++ \
&& yarn install \
&& apk del .gyp
COPY . .
RUN yarn build
# production environment
FROM nginx:alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /usr/src/app/build /usr/share/nginx/html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment