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.3 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
  1. # syntax=docker/dockerfile:1
  2. ARG INCLUDE_DB=false
  3. FROM node:20-slim AS base
  4. ENV PLAYWRIGHT_SKIP_BROWSER_GC=1
  5. # install dotenv-cli
  6. RUN npm install -g dotenv-cli
  7. # switch to a user that works for spaces
  8. RUN userdel -r node
  9. RUN useradd -m -u 1000 user
  10. USER user
  11. ENV HOME=/home/user \
  12. PATH=/home/user/.local/bin:$PATH
  13. WORKDIR /app
  14. # add a .env.local if the user doesn't bind a volume to it
  15. RUN touch /app/.env.local
  16. RUN npm i --no-package-lock --no-save playwright@1.47.0
  17. USER root
  18. RUN apt-get update
  19. RUN apt-get install gnupg curl -y
  20. RUN npx playwright install --with-deps chromium
  21. RUN chown -R 1000:1000 /home/user/.npm
  22. USER user
  23. COPY --chown=1000 .env /app/.env
  24. COPY --chown=1000 entrypoint.sh /app/entrypoint.sh
  25. COPY --chown=1000 gcp-*.json /app/
  26. COPY --chown=1000 package.json /app/package.json
  27. COPY --chown=1000 package-lock.json /app/package-lock.json
  28. RUN chmod +x /app/entrypoint.sh
  29. FROM node:20 AS builder
  30. WORKDIR /app
  31. COPY --link --chown=1000 package-lock.json package.json ./
  32. ARG APP_BASE=
  33. ARG PUBLIC_APP_COLOR=blue
  34. ENV BODY_SIZE_LIMIT=15728640
  35. RUN --mount=type=cache,target=/app/.npm \
  36. npm set cache /app/.npm && \
  37. npm ci
  38. COPY --link --chown=1000 . .
  39. RUN git config --global --add safe.directory /app && \
  40. npm run build
  41. # mongo image
  42. FROM mongo:7 AS mongo
  43. # image to be used if INCLUDE_DB is false
  44. FROM base AS local_db_false
  45. # image to be used if INCLUDE_DB is true
  46. FROM base AS local_db_true
  47. # copy mongo from the other stage
  48. COPY --from=mongo /usr/bin/mongo* /usr/bin/
  49. ENV MONGODB_URL=mongodb://localhost:27017
  50. USER root
  51. RUN mkdir -p /data/db
  52. RUN chown -R 1000:1000 /data/db
  53. USER user
  54. # final image
  55. FROM local_db_${INCLUDE_DB} AS final
  56. # build arg to determine if the database should be included
  57. ARG INCLUDE_DB=false
  58. ENV INCLUDE_DB=${INCLUDE_DB}
  59. # svelte requires APP_BASE at build time so it must be passed as a build arg
  60. ARG APP_BASE=
  61. # tailwind requires the primary theme to be known at build time so it must be passed as a build arg
  62. ARG PUBLIC_APP_COLOR=blue
  63. ARG PUBLIC_COMMIT_SHA=
  64. ENV PUBLIC_COMMIT_SHA=${PUBLIC_COMMIT_SHA}
  65. ENV BODY_SIZE_LIMIT=15728640
  66. #import the build & dependencies
  67. COPY --from=builder --chown=1000 /app/build /app/build
  68. COPY --from=builder --chown=1000 /app/node_modules /app/node_modules
  69. CMD ["/bin/bash", "-c", "/app/entrypoint.sh"]
Tip!

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

Comments

Loading...