-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
51 lines (35 loc) · 1.23 KB
/
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
48
49
50
51
FROM node:20-alpine3.20 AS base
WORKDIR /home/cards
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
RUN corepack prepare pnpm@9 --activate
COPY pnpm-lock.yaml ./
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
pnpm fetch \
| grep -v "cross-device link not permitted\|Falling back to copying packages from store"
FROM base AS prod-deps
COPY package.json ./
RUN pnpm clean
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
pnpm install \
--prefer-offline \
--frozen-lockfile \
--prod \
| grep -v "cross-device link not permitted\|Falling back to copying packages from store"
FROM base AS builder
COPY package.json tsconfig.json vite.config.ts postcss.config.js tailwind.config.ts ./
COPY app ./app
COPY public ./public
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
pnpm install \
--offline \
--frozen-lockfile
RUN pnpm build
FROM node:20-alpine3.20 AS runner
WORKDIR /home/cards
COPY --from=prod-deps /home/cards/node_modules ./node_modules
COPY --from=prod-deps /home/cards/package.json ./package.json
COPY --from=builder /home/cards/build ./build
COPY --from=builder /home/cards/public ./public
CMD ["sh", "./node_modules/.bin/remix-serve", "./build/server/index.js"]