forked from OrderlyNetwork/orderly-js-sdk-remix-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (28 loc) · 901 Bytes
/
Dockerfile
File metadata and controls
38 lines (28 loc) · 901 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
33
34
35
36
37
38
FROM node:20-slim AS base
# Args for vite
ARG VITE_MOCKBA_API_URL
ENV VITE_MOCKBA_API_URL=${VITE_MOCKBA_API_URL}
# Base image setup
FROM base AS deps
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
# Base installer
FROM base AS builder
WORKDIR /app
# Copy the package.json and package-lock.json first to leverage Docker cache
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# ⬇️ Write the env variable to .env.production so Vite will read it
RUN echo "VITE_MOCKBA_API_URL=$VITE_MOCKBA_API_URL" > .env.production
# Build it
RUN npm run build
FROM base AS runtime
WORKDIR /app
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./
COPY --from=builder /app/build/server ./build/server
COPY --from=builder /app/build/client ./build/client
EXPOSE 3000
# Use the production build of the server
CMD ["npm", "run", "start"]