Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

Dockerfile 2.6 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
  1. # This Dockerfile can be used for docker-based deployments to platforms
  2. # like Now or Moda, but it is currently _not_ used by our Heroku deployments
  3. # It uses two multi-stage builds: `install` and the main build to keep the image size down.
  4. # --------------------------------------------------------------------------------
  5. # BASE IMAGE
  6. # --------------------------------------------------------------------------------
  7. FROM node:16.2.0-alpine as base
  8. RUN apk add --no-cache make g++ git
  9. WORKDIR /usr/src/docs
  10. # ---------------
  11. # ALL DEPS
  12. # ---------------
  13. FROM base as all_deps
  14. COPY package*.json ./
  15. RUN npm ci
  16. # ---------------
  17. # PROD DEPS
  18. # ---------------
  19. FROM all_deps as prod_deps
  20. RUN npm prune --production
  21. # ---------------
  22. # BUILDER
  23. # ---------------
  24. FROM all_deps as builder
  25. ENV NODE_ENV production
  26. COPY javascripts ./javascripts
  27. COPY stylesheets ./stylesheets
  28. COPY pages ./pages
  29. COPY components ./components
  30. COPY lib ./lib
  31. # one part of the build relies on this content file to pull all-products
  32. COPY content/index.md ./content/index.md
  33. COPY webpack.config.js ./webpack.config.js
  34. COPY next.config.js ./next.config.js
  35. COPY tsconfig.json ./tsconfig.json
  36. RUN npx tsc
  37. RUN npm run build
  38. # --------------------------------------------------------------------------------
  39. # MAIN IMAGE
  40. # --------------------------------------------------------------------------------
  41. FROM node:16.2.0-alpine as production
  42. # Let's make our home
  43. WORKDIR /usr/src/docs
  44. # Ensure our node user owns the directory we're using
  45. RUN chown node:node /usr/src/docs -R
  46. # This should be our normal running user
  47. USER node
  48. # Copy just our prod dependencies
  49. COPY --chown=node:node --from=prod_deps /usr/src/docs/node_modules /usr/src/docs/node_modules
  50. # Copy our front-end code
  51. COPY --chown=node:node --from=builder /usr/src/docs/dist /usr/src/docs/dist
  52. COPY --chown=node:node --from=builder /usr/src/docs/.next /usr/src/docs/.next
  53. # We should always be running in production mode
  54. ENV NODE_ENV production
  55. # Use Lunr instead of Algolia
  56. ENV AIRGAP true
  57. # Copy only what's needed to run the server
  58. COPY --chown=node:node assets ./assets
  59. COPY --chown=node:node content ./content
  60. COPY --chown=node:node data ./data
  61. COPY --chown=node:node includes ./includes
  62. COPY --chown=node:node layouts ./layouts
  63. COPY --chown=node:node lib ./lib
  64. COPY --chown=node:node middleware ./middleware
  65. COPY --chown=node:node translations ./translations
  66. COPY --chown=node:node server.js ./server.js
  67. COPY --chown=node:node package*.json ./
  68. COPY --chown=node:node feature-flags.json ./
  69. EXPOSE 80
  70. EXPOSE 443
  71. EXPOSE 4000
  72. CMD ["node", "server.js"]
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...