-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update docker file to multi stage builds
- Loading branch information
1 parent
1872a5d
commit ebc91d9
Showing
2 changed files
with
30 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,43 @@ | ||
FROM node:20-alpine | ||
# tianji reporter | ||
FROM golang:1.21.1-bookworm AS reporter | ||
WORKDIR /app/reporter | ||
|
||
WORKDIR /app/tianji | ||
COPY ./reporter/ ./reporter/ | ||
|
||
RUN npm install -g [email protected] | ||
RUN apt update | ||
RUN cd reporter && go build . | ||
|
||
COPY . . | ||
# # Base ------------------------------ | ||
FROM node:20-alpine AS base | ||
|
||
RUN npm install -g [email protected] | ||
RUN apk add --update --no-cache python3 py3-pip g++ make | ||
|
||
# Tianji frontend ------------------------------ | ||
FROM base AS docker-static | ||
WORKDIR /app/tianji | ||
|
||
COPY . . | ||
|
||
RUN pnpm install --frozen-lockfile | ||
|
||
RUN pnpm build | ||
RUN pnpm build:static | ||
|
||
# Tianji server ------------------------------ | ||
FROM base AS docker-server | ||
WORKDIR /app/tianji | ||
|
||
COPY . . | ||
|
||
RUN pnpm install --filter @tianji/server... --config.dedupe-peer-dependents=false | ||
|
||
RUN mkdir -p ./src/server/public | ||
RUN COPY --from=docker-static /app/tianji/src/server/public /app/tianji/src/server/public | ||
|
||
RUN pnpm build:server | ||
|
||
# make sure run after pnpm build completed to avoid break system packages | ||
# Push client(only support pure text message) | ||
RUN pip install apprise --break-system-packages | ||
|
||
# remove unused source file | ||
RUN rm -rf ./src/client | ||
RUN rm -rf ./website | ||
RUN rm -rf ./reporter | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters