tianji/Dockerfile

64 lines
1.3 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 ------------------------------
FROM node:20-alpine 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
RUN apk add --update --no-cache python3 py3-pip g++ make
2024-01-13 10:16:09 +00:00
# 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 . .
2023-10-17 11:41:42 +00:00
RUN pnpm install --frozen-lockfile
ENV VITE_VERSION=$VERSION
RUN pnpm build:static
# Tianji server ------------------------------
2024-03-08 13:36:23 +00:00
FROM base AS app
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
ENV DEBUG=puppeteer:*
2024-09-28 17:41:01 +00:00
RUN apk add --no-cache \
udev \
ttf-freefont \
chromium
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"]