-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
47 lines (29 loc) · 847 Bytes
/
Dockerfile
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
# syntax=docker/dockerfile:1
FROM node:bookworm-slim as base
EXPOSE 3000
ENV NODE_ENV production
FROM base as deps
WORKDIR /myapp
ADD server.mjs ./
ADD package.json ./
RUN npm install --include=dev
FROM base as production-deps
WORKDIR /myapp
COPY --from=deps /myapp/node_modules /myapp/node_modules
ADD server.mjs ./
ADD package.json ./
RUN npm prune --omit=dev
FROM base as build
WORKDIR /myapp
COPY --from=deps /myapp/node_modules /myapp/node_modules
ADD . .
RUN npx remix build
FROM base
ENV NODE_ENV="production"
WORKDIR /myapp
COPY --from=production-deps /myapp/node_modules /myapp/node_modules
COPY --from=build /myapp/build /myapp/build
COPY --from=build /myapp/public /myapp/public
COPY --from=build /myapp/package.json /myapp/package.json
COPY --from=build /myapp/server.mjs /myapp/server.mjs
CMD ["node", "server.mjs"]