Dockerfile 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. RUN npm i -g npm
  18. COPY --chown=app:app . /app
  19. USER app
  20. WORKDIR /app
  21. RUN set -x \
  22. # Build
  23. && npm ci \
  24. && npm run build
  25. # Main image
  26. FROM node:12-slim
  27. RUN set -x \
  28. # Add user
  29. && addgroup --gid 10001 app \
  30. && adduser --disabled-password \
  31. --gecos '' \
  32. --gid 10001 \
  33. --home /app \
  34. --uid 10001 \
  35. app
  36. RUN apt-get update && apt-get -y install \
  37. git-core \
  38. && rm -rf /var/lib/apt/lists/*
  39. USER app
  40. WORKDIR /app
  41. COPY --chown=app:app package*.json ./
  42. COPY --chown=app:app app app
  43. COPY --chown=app:app common common
  44. COPY --chown=app:app public/locales public/locales
  45. COPY --chown=app:app server server
  46. COPY --chown=app:app --from=builder /app/dist dist
  47. RUN npm ci --production && npm cache clean --force
  48. RUN mkdir -p /app/.config/configstore
  49. RUN ln -s dist/version.json version.json
  50. ENV PORT=1443
  51. EXPOSE ${PORT}
  52. CMD ["node", "server/bin/prod.js"]