-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (38 loc) · 1.13 KB
/
Dockerfile
File metadata and controls
41 lines (38 loc) · 1.13 KB
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
#slight change
FROM node:22-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
WORKDIR /app
RUN chown node:node /app
COPY --chown=node:node . /app
COPY <<'EOF' /usr/bin/docker-entrypoint
#!/bin/sh
export PATH="/app/node_modules/.bin:$PATH"
node scripts/fetch-registry.mjs
if [ $# -eq 0 ]; then
# If no arguments given, use default command
set -- ponder start
elif [ "${1#-}" != "$1" ]; then
# If first arg starts with '-', prepend default command
set -- ponder start "$@"
else
# Otherwise use args as-is (allows overriding with direct commands)
set -- ponder "$@"
fi
exec "$@"
EOF
RUN chmod a+x /usr/bin/docker-entrypoint
ENTRYPOINT ["/usr/bin/docker-entrypoint"]
FROM base AS dev-deps
USER node
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile --ignore-scripts
FROM base AS prod-deps
USER node
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile --prod --ignore-scripts
FROM base
ENV NODE_ENV=production DATABASE_SCHEMA=app
COPY --from=prod-deps --chown=node:node /app/node_modules /app/node_modules
EXPOSE 8000
USER node
CMD ["start", "--port", "8000"]