Skip to content
This repository was archived by the owner on Sep 17, 2023. It is now read-only.

Commit 49d60c7

Browse files
committed
feat: add Dockerfile
1 parent 4442a03 commit 49d60c7

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

Dockerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# rust:1.56.1
2+
from rust@sha256:dd7167fc31b49284971b42f9b227bcac2fe3b8c2709259ec64dab7a05b5b07b0 as build-image
3+
4+
# create a dummy project
5+
RUN apt-get update && \
6+
apt-get install --yes musl-tools curl llvm clang && \
7+
rustup target add x86_64-unknown-linux-musl && \
8+
USER=root cargo new --bin rust-implementation
9+
WORKDIR /rust-implementation
10+
11+
# copy over manifests
12+
COPY ./Cargo.lock ./Cargo.lock
13+
COPY ./Cargo.toml ./Cargo.toml
14+
15+
# cache build dependencies
16+
RUN cargo build --release --target x86_64-unknown-linux-musl && \
17+
rm -r src/
18+
19+
# copy over project source
20+
COPY ./src ./src
21+
22+
# build for release
23+
RUN rm -f ./target/x86_64-unknown-linux-musl/release/deps/rust_typescript_tools* && \
24+
cargo build --release --target x86_64-unknown-linux-musl
25+
26+
FROM scratch
27+
COPY --from=build-image /rust-implementation/target/x86_64-unknown-linux-musl/release/rust_typescript_tools /usr/bin/typescript-tools
28+
WORKDIR /workdir
29+
ENTRYPOINT ["/usr/bin/typescript-tools"]
30+
CMD [""]

0 commit comments

Comments
 (0)