Files
zkldi_Tachi/Dockerfile.server
T
zk 87ede2d85b feat: Session Playtime (#1139)
* style: consistent capitalization in dckerfile

* feat: Session Playtime
2024-08-03 13:38:47 +01:00

51 lines
1.3 KiB
Docker

# 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"]