-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (24 loc) · 836 Bytes
/
Copy pathDockerfile
File metadata and controls
32 lines (24 loc) · 836 Bytes
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
# Build container
FROM node:lts-alpine AS builder
# Use Workdir because things like tailwind will scan the entire current dir and can cause issues if it scans root
WORKDIR /app
# Toolchain for compiling native modules (e.g. better-sqlite3) from source.
# Alpine (musl) has no prebuilt binaries for them, so node-gyp needs Python + a
# C/C++ compiler. Only the builder needs these; the deployment image just runs
# the bundled .output.
RUN apk add --no-cache python3 make g++
COPY package.json ./
COPY pnpm-lock.yaml ./
COPY pnpm-workspace.yaml ./
ENV PNPM_HOME="~/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN npm i -g pnpm
RUN pnpm i --frozen-lockfile
COPY . ./
RUN pnpm run build
# Deployment container
FROM node:lts-alpine AS deployment
WORKDIR /app
COPY --from=builder /app/.output ./
EXPOSE 3000
CMD ["node", "./server/index.mjs"]