Skip to content

Instantly share code, notes, and snippets.

@lomocc
Created November 29, 2018 02:51
Show Gist options
  • Save lomocc/9c820ca5582e09d450a4215a1e4bac79 to your computer and use it in GitHub Desktop.
Save lomocc/9c820ca5582e09d450a4215a1e4bac79 to your computer and use it in GitHub Desktop.
Dockerfile
# build environment
FROM node as builder
ARG REACT_APP_SHA
ENV REACT_APP_SHA=${REACT_APP_SHA}
RUN mkdir /usr/src/app
WORKDIR /usr/src/app
ENV PATH /usr/src/app/node_modules/.bin:$PATH
COPY package.json /usr/src/app/package.json
RUN npm install -g -s --no-progress yarn
RUN yarn add react-scripts -g
COPY . /usr/src/app
RUN yarn build
# production environment
FROM nginx:1.13.9-alpine
COPY --from=builder /usr/src/app/build /usr/share/nginx/html
# Fix NGINX config for React
#RUN sed -ie 's/index index.html index.htm;/try_files $uri $uri\/ \/index.html;/g' /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
FROM node
RUN apt-get update && \
apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
RUN git clone https://github.com/GoogleChrome/rendertron.git
WORKDIR rendertron
RUN npm install
RUN npm run build
ENV PORT=80
EXPOSE 80
CMD ["npm", "start"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment