Untitled

FROM node:12-slim
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 \
    fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont \
    ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget && \
    wget https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64.deb && \
    dpkg -i dumb-init_*.deb && rm -f dumb-init_*.deb && \
    apt-get clean && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
RUN yarn global add puppeteer && yarn cache clean
ENV NODE_PATH="/usr/local/share/.config/yarn/global/node_modules:${NODE_PATH}"
ENV PATH="/tools:${PATH}"
RUN groupadd -r cubeuser && useradd -r -g cubeuser cubeuser
# Set language to UTF8
ENV LANG="C.UTF-8"
RUN mkdir -p /usr/src/app
RUN mkdir -p /home/cubeuser
RUN chown cubeuser /usr/src/app
# Add user so we don't need --no-sandbox.
# Run everything after as non-privileged user.
RUN chown -R cubeuser:cubeuser /home/cubeuser \
    && chown -R cubeuser:cubeuser /usr/local/share/.config/yarn/global/node_modules \
    && chown -R cubeuser:cubeuser /usr/src/app
# --cap-add=SYS_ADMIN
# https://docs.docker.com/engine/reference/run/#additional-groups
# Actual step to launch the Application
WORKDIR /usr/src/app
COPY package.json /usr/src/app/
# COPY .npmrc /usr/src/app/
RUN npm install
COPY . /usr/src/app/
RUN chown -R cubeuser:cubeuser /usr/src/app/start-server.sh
# ADD public /usr/src/app/public
USER cubeuser
EXPOSE 3000
RUN chmod a+x start-server.sh
ENTRYPOINT ["./start-server.sh"]