Skip to content

Instantly share code, notes, and snippets.

@MnifR
Last active February 18, 2020 09:22
Show Gist options
  • Save MnifR/21ea68765072f274f6d2306c31e6e2c8 to your computer and use it in GitHub Desktop.
Save MnifR/21ea68765072f274f6d2306c31e6e2c8 to your computer and use it in GitHub Desktop.
Dockerfile
# stage1 as builder
FROM node:lts-alpine as builder
# copy the package.json to install dependencies
COPY package.json package-lock.json ./
# Install the dependencies and make the folder
RUN npm install && mkdir /react-ui && mv ./node_modules ./react-ui
WORKDIR /react-ui
COPY . .
# Build the project and copy the files
RUN npm run build
FROM nginx:alpine
#!/bin/sh
COPY ./.nginx/nginx.conf /etc/nginx/nginx.conf
## Remove default nginx index page
RUN rm -rf /usr/share/nginx/html/*
# Copy from the stahg 1
COPY --from=builder /react-ui/build /usr/share/nginx/html
EXPOSE 3000 80
ENTRYPOINT ["nginx", "-g", "daemon off;"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment