Dockerfile 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. ##
  2. # Firefox Send - Mozilla
  3. #
  4. # License https://github.com/mozilla/send/blob/master/LICENSE
  5. ##
  6. # Build project
  7. FROM node:12 AS builder
  8. RUN set -x \
  9. # Add user
  10. && addgroup --gid 10001 app \
  11. && adduser --disabled-password \
  12. --gecos '' \
  13. --gid 10001 \
  14. --home /app \
  15. --uid 10001 \
  16. app
  17. COPY --chown=app:app . /app
  18. USER app
  19. WORKDIR /app
  20. RUN set -x \
  21. # Build
  22. && PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm ci \
  23. && npm run build
  24. # Main image
  25. FROM node:12-slim
  26. RUN set -x \
  27. # Add user
  28. && addgroup --gid 10001 app \
  29. && adduser --disabled-password \
  30. --gecos '' \
  31. --gid 10001 \
  32. --home /app \
  33. --uid 10001 \
  34. app
  35. RUN apt-get update && apt-get -y install \
  36. git-core \
  37. && rm -rf /var/lib/apt/lists/*
  38. USER app
  39. WORKDIR /app
  40. COPY --chown=app:app package*.json ./
  41. COPY --chown=app:app app app
  42. COPY --chown=app:app common common
  43. COPY --chown=app:app public/locales public/locales
  44. COPY --chown=app:app server server
  45. COPY --chown=app:app --from=builder /app/dist dist
  46. RUN npm ci --production && npm cache clean --force
  47. RUN mkdir -p /app/.config/configstore
  48. RUN ln -s dist/version.json version.json
  49. ENV PORT=1443
  50. EXPOSE ${PORT}
  51. CMD ["node", "server/bin/prod.js"]