-
-
Notifications
You must be signed in to change notification settings - Fork 58
/
Dockerfile.server
51 lines (36 loc) · 1.25 KB
/
Dockerfile.server
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
# This dockerfile spins up an instance of tachi-server and *tachi-server* alone.
# It does not spin up mongodb instances or redis instances, which the server
# does need to boot. You should consider using docker-compose for this.
# base image
FROM node:20-alpine AS base
ARG COMMIT_HASH
ENV COMMIT_HASH=${COMMIT_HASH}
RUN npm install --silent -g pnpm@8.15.6
RUN apk add --no-cache git curl
# install dependencies
FROM base AS install
WORKDIR /app
COPY pnpm-lock.yaml .
COPY patches ./patches
RUN pnpm fetch
COPY server ./server
COPY common ./common
COPY *.json *.yaml ./
RUN pnpm --filter tachi-server... --filter . install --offline --frozen-lockfile
# development image, keeps installed dependencies
FROM install AS dev
RUN git config --global --add safe.directory /app
HEALTHCHECK --interval=15s --timeout=5s CMD curl -f http://localhost:8080/api/v1/status || exit 1
WORKDIR /app/server
ENV NODE_PATH=js/
CMD ["pnpm", "dev"]
# build source and dependencies
FROM install AS build
RUN pnpm --filter tachi-server... -r build
# built source only for production
FROM base AS prod
COPY --from=build /app /app
HEALTHCHECK --interval=15s --timeout=5s CMD curl -f http://localhost:8080/api/v1/status || exit 1
WORKDIR /app/server
ENV NODE_PATH=js/
CMD ["node", "js/main.js"]