tianji/Dockerfile

76 lines
1.8 KiB
Docker
Raw Normal View History

# tianji reporter
FROM golang:1.21.1-bookworm AS reporter
WORKDIR /app/reporter
2023-10-17 11:41:42 +00:00
COPY ./reporter/ ./reporter/
2023-10-17 11:41:42 +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 ------------------------------
# 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
# For apprise
RUN apk add --update --no-cache python3 py3-pip g++ make
2024-01-13 10:16:09 +00:00
# For puppeteer
RUN apk upgrade --no-cache --available \
&& apk add --no-cache \
chromium-swiftshader \
ttf-freefont \
font-noto-emoji \
&& apk add --no-cache \
--repository=https://dl-cdn.alpinelinux.org/alpine/edge/community \
font-wqy-zenhei
# For zeromq
RUN apk add --update --no-cache curl cmake
# Tianji frontend ------------------------------
2024-03-08 13:36:23 +00:00
FROM base AS static
WORKDIR /app/tianji
# use with --build-arg VERSION=xxxx
ARG VERSION
COPY . .
RUN pnpm install --filter @tianji/client... --config.dedupe-peer-dependents=false --frozen-lockfile
2023-10-17 11:41:42 +00:00
ENV VITE_VERSION=$VERSION
ENV NODE_OPTIONS="--max-old-space-size=4096"
RUN pnpm build:static
# Tianji server ------------------------------
2024-03-08 13:36:23 +00:00
FROM base AS app
WORKDIR /app/tianji
# We don't need the standalone Chromium in alpine.
ENV PUPPETEER_SKIP_DOWNLOAD=true
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
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
RUN pnpm build:server
2023-10-17 11:41:42 +00:00
RUN pip install apprise --break-system-packages
RUN rm -rf ./src/client
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"]