-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Dockerfile
36 lines (26 loc) · 988 Bytes
/
Dockerfile
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
FROM rust:1.80-slim AS base
WORKDIR /analyzer
COPY . .
RUN cargo build --release
# cargo-local-registry stuff is copied from the test runner
FROM rust:1.80 AS build-cargo-local-registry
# install cargo-local-registry
RUN cargo install cargo-local-registry
# download popular crates to local registry
WORKDIR /local-registry
COPY local-registry/* ./
RUN cargo generate-lockfile && cargo local-registry --sync Cargo.lock .
FROM rust:1.80-slim
WORKDIR /opt/analyzer
RUN rustup component add clippy
COPY ./bin/run.sh ./bin/
COPY --from=base /analyzer/target/release/rust-analyzer ./bin/rust-analyzer
COPY --from=build-cargo-local-registry /local-registry local-registry/
# configure local-registry
RUN echo '[source.crates-io]\n\
registry = "https://github.com/rust-lang/crates.io-index"\n\
replace-with = "local-registry"\n\
\n\
[source.local-registry]\n\
local-registry = "/opt/analyzer/local-registry/"\n' >> $CARGO_HOME/config.toml
ENTRYPOINT ["bin/run.sh"]