-
Notifications
You must be signed in to change notification settings - Fork 18
/
local.Dockerfile
45 lines (31 loc) · 1.16 KB
/
local.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
37
38
39
40
41
42
43
44
45
FROM rust:1.72.0 AS helix
RUN apt update -y
RUN apt install -y clang
RUN apt install -y protobuf-compiler
RUN wget https://github.com/mozilla/sccache/releases/download/v0.3.1/sccache-v0.3.1-x86_64-unknown-linux-musl.tar.gz \
&& tar xzf sccache-v0.3.1-x86_64-unknown-linux-musl.tar.gz \
&& mv sccache-v0.3.1-x86_64-unknown-linux-musl/sccache /usr/local/bin/sccache \
&& chmod +x /usr/local/bin/sccache
# Copy necessary contents into the container at /app
ADD ./ /app/
RUN ls -lah /app
# Set the working directory to /app
WORKDIR /app/
RUN --mount=type=cache,target=/root/.cargo \
--mount=type=cache,target=/usr/local/cargo/registry \
cargo fetch
# Run build
RUN --mount=type=cache,target=/root/.cargo \
--mount=type=cache,target=/usr/local/cargo/registry \
RUSTC_WRAPPER=/usr/local/bin/sccache cargo build -p helix-cmd --release
# Copy binary into the workdir
RUN mv /app/target/release/helix-cmd /app/helix-cmd
# our final base
FROM debian:stable-slim
RUN mkdir /root/logs
RUN apt-get update
RUN apt-get install -y ca-certificates
WORKDIR /app
COPY --from=helix /app/helix-cmd* ./
# set the startup command to run your binary
ENTRYPOINT ["/app/helix-cmd"]