tianji/Dockerfile

54 lines
1.0 KiB
Docker
Raw Permalink 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
# # Base ------------------------------
FROM node:20-alpine AS base
2023-10-17 11:41:42 +00:00
RUN npm install -g pnpm@9.5.0
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
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"]