-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
33 lines (25 loc) · 940 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
FROM node:lts-alpine AS base
WORKDIR /workspace
# Setup corepack with version of pnpm specified in package.json
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml /workspace/
RUN corepack enable && \
corepack prepare && \
pnpm config set store-dir /tmp/cache/pnpm
# Fetch build and runtime dependencies
RUN --mount=type=cache,target=/tmp/cache \
pnpm fetch --workspace-root
# Install required dependencies
COPY . /workspace/
# Install dependencies cached above
RUN --mount=type=cache,target=/tmp/cache \
pnpm install -r --offline
# Expose port we are running the frontend on
EXPOSE 5173
# In development we expose the Vite hot reload port and install all dependencies
FROM base AS development
EXPOSE 24678
CMD [ "pnpm", "web", "dev", "--host" ]
# In production we run the build version of code without hot reload
FROM base AS production
RUN pnpm web build
CMD [ "pnpm", "web", "preview", "--host", "--port=5173" ]