blob: 92edfb32c18b57c503ac19169c7c671c6cbfe7f5 (
plain) (
blame)
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
53
54
55
56
57
58
59
|
FROM clux/muslrust:nightly-2022-05-18 AS environment
ENV CHANNEL=nightly-2022-05-18
RUN curl "https://static.rust-lang.org/rustup/archive/${RUSTUP_VER}/${RUST_ARCH}/rustup-init" -o rustup-init \
&& chmod +x rustup-init \
&& ./rustup-init -y --default-toolchain ${CHANNEL} --profile minimal \
&& rm rustup-init \
&& ~/.cargo/bin/rustup target add x86_64-unknown-linux-musl \
&& echo "[build]\ntarget = \"x86_64-unknown-linux-musl\"" > ~/.cargo/config
RUN cargo install sccache
# RUN apt-get update && apt-get install clang-3.9 -y
RUN apt-get update && apt-get install -y gnupg2
RUN curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
&& apt-get install -y clang
RUN cargo install \
--git https://github.com/dimensionhq/fleet \
--rev 693a0d40aaf2dab5acea84ee8de15ec36dd12199 \
fleet-rs
FROM environment as builder
WORKDIR /usr/src
RUN cargo new locus
WORKDIR /usr/src/locus
COPY Cargo.* .
RUN fleet build --release
COPY . .
RUN --mount=type=cache,target=/usr/src/locus/target \
--mount=type=cache,target=/root/.cargo/registry \
fleet build --release --bin locus \
&& strip -s /usr/src/locus/target/x86_64-unknown-linux-musl/release/locus \
&& mv /usr/src/locus/target/x86_64-unknown-linux-musl/release/locus .
FROM gcr.io/distroless/static:nonroot
WORKDIR /locus
COPY --from=builder --chown=nonroot:nonroot /usr/src/locus/locus .
COPY --from=builder --chown=nonroot:nonroot /usr/src/locus/content ./content
# CBA
USER root
EXPOSE 1965
ENTRYPOINT ["/locus/locus"]
|