-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (34 loc) · 1.4 KB
/
Dockerfile
File metadata and controls
49 lines (34 loc) · 1.4 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
42
43
44
45
46
47
48
49
# base node image
FROM node:24-bullseye-slim as base
# Install all node_modules, including dev
FROM base as deps
WORKDIR /remixapp
COPY package.json pnpm-lock.yaml ./
RUN corepack enable && pnpm install --frozen-lockfile --prod=false
# Setup production node_modules
FROM base as production-deps
WORKDIR /remixapp
COPY --from=deps /remixapp/node_modules /remixapp/node_modules
COPY package.json pnpm-lock.yaml ./
RUN corepack enable && pnpm prune --prod
# Build the app
FROM base as build
WORKDIR /remixapp
COPY --from=deps /remixapp/node_modules /remixapp/node_modules
COPY . .
RUN corepack enable && pnpm run build
# Finally, build the production image with minimal footprint
FROM base
ENV PORT="8080"
ENV NODE_ENV="production"
WORKDIR /remixapp
COPY --chown=node:node --from=production-deps /remixapp/node_modules /remixapp/node_modules
COPY --chown=node:node --from=build /remixapp/app /remixapp/app
COPY --chown=node:node --from=build /remixapp/public /remixapp/public
COPY --chown=node:node --from=build /remixapp/server.ts /remixapp/server.ts
COPY --chown=node:node --from=build /remixapp/tsconfig.json /remixapp/tsconfig.json
COPY --chown=node:node --from=build /remixapp/_redirects /remixapp/_redirects
COPY --chown=node:node --from=build /remixapp/data /remixapp/data
COPY --chown=node:node --from=build /remixapp/package.json /remixapp/package.json
USER node
CMD ["node", "--import", "tsx", "server.ts"]