ahbeng/NUSMods

View on GitHub
export/Dockerfile.dev

Summary

Maintainability
Test Coverage
FROM node:12-alpine

# Installs Chromium package.
RUN apk update && apk upgrade && \
    echo @edge http://nl.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories && \
    echo @edge http://nl.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories && \
    apk add --no-cache \
      chromium

# Tell Puppeteer to skip installing Chrome. We'll be using the installed package.
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true

# Add user so we don't need --no-sandbox.
RUN mkdir -p /home/node/Downloads \
    && chown -R node:node /home/node

# Run everything after as non-privileged user.
USER node

RUN mkdir -p /home/node/app
WORKDIR /home/node/app/export

COPY export/package.json export/yarn.lock ./

# Double -- needed as there is currently no way to force Yarn to pass through
# --, even though this causes Yarn to display its dashDashDeprecation warning.
# See: https://github.com/yarnpkg/yarn/blob/4df89bc/src/cli/index.js#L202-L228
CMD yarn && yarn dev -- -- --exitcrash