-
Notifications
You must be signed in to change notification settings - Fork 98
/
Dockerfile.browser
45 lines (33 loc) · 1.12 KB
/
Dockerfile.browser
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
# Builder stage
FROM node:lts-alpine AS builder
RUN npm install -g pnpm
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile --ignore-scripts
COPY . .
RUN pnpm build
# Runner stage
FROM node:lts
RUN apt update && apt install -y chromium xvfb
RUN npm install -g pnpm
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile --ignore-scripts --prod
# Install prebuilt lmdb binary
RUN arch_out=$(uname -m) \
&& if [ "${arch_out}" = "x86_64" ]; then \
ARCH=x64; \
elif [ "${arch_out}" = "aarch64" ]; then \
ARCH=arm64; \
elif echo "${arch_out}" | grep -q "armv"; then \
ARCH=arm; \
else \
ARCH=${arch_out}; \
fi \
&& LMDB_VER=$(pnpm list lmdb | grep lmdb | awk '{print $2}') \
&& pnpm add @lmdb/lmdb-linux-$ARCH@$LMDB_VER --ignore-scripts --prod --no-optional
# We can also build it ourselves:
# RUN npm explore lmdb -- npm run install
COPY --from=builder /app/dist ./dist
CMD xvfb-run -a --server-args="-screen 0 1280x800x24 -ac -nolisten tcp -dpi 96 +extension RANDR" pnpm start