2024-03-07 19:06:38 +00:00
# tianji reporter
FROM golang:1.21.1-bookworm AS reporter
WORKDIR /app/reporter
2023-10-17 11:41:42 +00:00
2024-03-07 19:06:38 +00:00
COPY ./reporter/ ./reporter/
2023-10-17 11:41:42 +00:00
2024-03-07 19:06:38 +00:00
RUN apt update
RUN cd reporter && go build .
2023-10-17 11:41:42 +00:00
2024-09-28 17:41:01 +00:00
# Base ------------------------------
2024-09-30 09:21:11 +00:00
# The current Chromium version in Alpine 3.20 is causing timeout issues with Puppeteer. Downgrading to Alpine 3.19 fixes the issue. See #11640, #12637, #12189
FROM node:20-alpine3.19 AS base
2023-10-17 11:41:42 +00:00
2024-08-29 17:03:23 +00:00
RUN npm install -g pnpm@9.7.1
2024-01-18 18:40:32 +00:00
RUN apk add --update --no-cache python3 py3-pip g++ make
2024-01-13 10:16:09 +00:00
2024-03-07 19:06:38 +00:00
# Tianji frontend ------------------------------
2024-03-08 13:36:23 +00:00
FROM base AS static
2024-03-07 19:06:38 +00:00
WORKDIR /app/tianji
2024-05-04 17:07:35 +00:00
# use with --build-arg VERSION=xxxx
ARG VERSION
2024-03-07 19:06:38 +00:00
COPY . .
2023-10-17 11:41:42 +00:00
RUN pnpm install --frozen-lockfile
2024-05-04 17:07:35 +00:00
ENV VITE_VERSION = $VERSION
2024-03-07 19:06:38 +00:00
RUN pnpm build:static
# Tianji server ------------------------------
2024-03-08 13:36:23 +00:00
FROM base AS app
2024-03-07 19:06:38 +00:00
WORKDIR /app/tianji
2024-09-28 17:41:01 +00:00
# We don't need the standalone Chromium
ENV PUPPETEER_SKIP_DOWNLOAD = true
ENV PUPPETEER_EXECUTABLE_PATH = /usr/bin/chromium-browser
2024-09-30 06:48:24 +00:00
ENV DEBUG = puppeteer:*
2024-09-28 17:41:01 +00:00
RUN apk add --no-cache \
2024-09-30 09:21:11 +00:00
chromium \
nss \
freetype \
harfbuzz \
ca-certificates \
ttf-freefont
2024-09-28 17:41:01 +00:00
2024-03-07 19:06:38 +00:00
COPY . .
RUN pnpm install --filter @tianji/server... --config.dedupe-peer-dependents= false
RUN mkdir -p ./src/server/public
2024-03-09 06:17:33 +00:00
COPY --from= static /app/tianji/geo /app/tianji/geo
2024-03-08 13:36:23 +00:00
COPY --from= static /app/tianji/src/server/public /app/tianji/src/server/public
2024-03-07 19:06:38 +00:00
RUN pnpm build:server
2023-10-17 11:41:42 +00:00
2024-01-20 08:22:44 +00:00
RUN pip install apprise --break-system-packages
2024-01-18 16:33:10 +00:00
2024-01-28 17:00:35 +00:00
RUN rm -rf ./src/client
2023-11-07 08:56:16 +00:00
RUN rm -rf ./website
RUN rm -rf ./reporter
2023-10-17 11:41:42 +00:00
EXPOSE 12345
2023-10-18 16:24:53 +00:00
CMD [ "pnpm" , "start:docker" ]