forked from typescript-tools/rust-implementation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
27 lines (21 loc) · 972 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
from rust:1.59.0@sha256:12993d6e83049487cabb7afe0864535140f6e8b0322a45532a0a337fac870355 as build-image
# create a dummy project
RUN apt-get update && \
apt-get install --yes musl-tools curl llvm clang && \
rustup target add x86_64-unknown-linux-musl && \
USER=root cargo new --bin rust-implementation
WORKDIR /rust-implementation
# copy over manifests
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
# cache build dependencies
RUN cargo build --release --target x86_64-unknown-linux-musl && \
rm -r src/
# copy over project source
COPY ./templates ./templates
COPY ./src ./src
# build for release
RUN rm -f ./target/x86_64-unknown-linux-musl/release/deps/monorepo* && \
cargo build --release --target x86_64-unknown-linux-musl
from alpine:3.15.0@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300
COPY --from=build-image /rust-implementation/target/x86_64-unknown-linux-musl/release/monorepo /usr/bin/monorepo