Dockerfile 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. ##
  2. # Send
  3. #
  4. # License https://gitlab.com/timvisee/send/blob/master/LICENSE
  5. ##
  6. # Build project
  7. FROM node:16.13-alpine3.13 AS builder
  8. RUN set -x \
  9. # Change node uid/gid
  10. && apk --no-cache add shadow \
  11. && groupmod -g 1001 node \
  12. && usermod -u 1001 -g 1001 node
  13. RUN set -x \
  14. # Add user
  15. && addgroup --gid 1000 app \
  16. && adduser --disabled-password \
  17. --gecos '' \
  18. --ingroup app \
  19. --home /app \
  20. --uid 1000 \
  21. app
  22. COPY --chown=app:app . /app
  23. USER app
  24. WORKDIR /app
  25. RUN set -x \
  26. # Build
  27. && PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm ci \
  28. && npm run build
  29. # Main image
  30. FROM node:16.13-alpine3.13
  31. RUN set -x \
  32. # Change node uid/gid
  33. && apk --no-cache add shadow \
  34. && groupmod -g 1001 node \
  35. && usermod -u 1001 -g 1001 node
  36. RUN set -x \
  37. # Add user
  38. && addgroup --gid 1000 app \
  39. && adduser --disabled-password \
  40. --gecos '' \
  41. --ingroup app \
  42. --home /app \
  43. --uid 1000 \
  44. app
  45. USER app
  46. WORKDIR /app
  47. COPY --chown=app:app package*.json ./
  48. COPY --chown=app:app app app
  49. COPY --chown=app:app common common
  50. COPY --chown=app:app public/locales public/locales
  51. COPY --chown=app:app server server
  52. COPY --chown=app:app --from=builder /app/dist dist
  53. RUN npm ci --production && npm cache clean --force
  54. RUN mkdir -p /app/.config/configstore
  55. RUN ln -s dist/version.json version.json
  56. ENV PORT=1443
  57. EXPOSE ${PORT}
  58. CMD ["node", "server/bin/prod.js"]