-
-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathDockerfile.heavy
More file actions
52 lines (40 loc) · 1.65 KB
/
Dockerfile.heavy
File metadata and controls
52 lines (40 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
FROM node:24-slim AS node_source
# ---
FROM rust:slim AS planner
RUN apt-get update && apt-get install -y --no-install-recommends build-essential && rm -rf /var/lib/apt/lists/*
RUN cargo install cargo-chef
COPY . /app/repo
WORKDIR /app/repo
RUN cargo chef prepare --recipe-path recipe.json
# ---
FROM rust:slim AS builder
RUN apt-get update && apt-get install -y --no-install-recommends \
inotify-tools \
git \
perl \
build-essential \
mold \
clang \
&& rm -rf /var/lib/apt/lists/*
COPY --from=node_source /usr/local/lib/node_modules /usr/local/lib/node_modules
COPY --from=node_source /usr/local/bin/node /usr/local/bin/node
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \
&& ln -s /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx
RUN npm install -g pnpm@10
RUN cargo install cargo-chef
WORKDIR /app/repo
COPY --from=planner /app/repo/recipe.json recipe.json
RUN mkdir -p .cargo && \
printf '[target."x86_64-unknown-linux-gnu"]\nlinker = "clang"\nrustflags = ["-C", "link-arg=-fuse-ld=mold"]\n' > .cargo/config.toml
RUN cargo chef cook --profile heavy-release --recipe-path recipe.json
COPY . /app/repo
RUN cd frontend && pnpm install --frozen-lockfile && pnpm build:ci
RUN cargo build --profile heavy-release --workspace
RUN ln -s /app/repo/target/heavy-release/panel-rs /usr/local/bin/panel-rs
RUN ln -s /app/repo/target/heavy-release/panel-rs /usr/local/bin/calagopus-panel
COPY entrypoint.heavy.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENV OCI_CONTAINER=official-heavy
ENV CARGO_BUILD_PROFILE=balanced
ENV CARGO_TARGET_PROFILE=heavy-release
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]