-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
72 lines (53 loc) · 1.5 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
## Base image
FROM node:18-alpine AS base
# Install package manager
RUN npm i --global --no-update-notifier --no-fund pnpm
# Set the working directory
WORKDIR /app
## Builder image
FROM base AS web-builder
# Copy the package.json and package-lock.json
COPY package*.json ./
COPY pnpm-lock.yaml ./
# Install the dependencies
RUN pnpm install --frozen-lockfile
# Copy the source code
COPY . .
# Build the app
RUN SKIP_ENV_VALIDATION=true npm run build
## Builder for llama-cpp
FROM alpine:3.14 AS llama-cpp-builder
# Install build dependencies
RUN apk add --no-cache \
build-base \
make \
git
# Set the working directory
WORKDIR /app
# Clone the repository
RUN git clone --depth 1 --branch tcp_server \
https://github.com/ggerganov/llama.cpp.git .
# Build
RUN make
# Production image based on alpine node:18
FROM base AS production
# Set the working directory
WORKDIR /app
# Copy the package.json and package-lock.json
COPY package*.json ./
COPY pnpm-lock.yaml ./
# Install production dependencies
RUN pnpm install --frozen-lockfile --production
# Copy all the built files
COPY --from=llama-cpp-builder /app/main ./bin/main
COPY --from=web-builder /app/ ./
# COPY --from=web-builder /app/dist ./dist
# COPY --from=web-builder /app/.next ./.next
# COPY --from=web-builder /app/public ./public
# COPY --from=web-builder /app/scripts ./scripts
# COPY --from=web-builder /app/src/env.mjs ./src/env.mjs
# Default environment variables
ENV NODE_ENV=production
ENV HOST=0.0.0.0
# Done
CMD ["pnpm", "run", "start"]