aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
blob: 4cf53740db9f5a41c0ba23354ae433adaeacbc68 (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
FROM clux/muslrust:nightly as dependencies

RUN rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu

FROM clux/muslrust:nightly as build

WORKDIR /source

RUN cargo new locus

WORKDIR /source/locus

COPY amenadiel/ ./amenadiel/
COPY Cargo.* .

RUN rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
RUN cargo build --release -Zbuild-std

COPY .git .git
COPY content content
COPY src src
COPY build.rs build.rs
COPY yarte.toml yarte.toml

RUN --mount=type=cache,target=/source/locus/target \
  --mount=type=cache,target=/root/.cargo/registry \
  cargo build --release --bin locus \
  && strip -s /source/locus/target/x86_64-unknown-linux-musl/release/locus \
  && mv /source/locus/target/x86_64-unknown-linux-musl/release/locus .

FROM gcr.io/distroless/static:nonroot

WORKDIR /locus

COPY --from=build /source/locus/locus .
COPY ./content ./content

# CBA
USER root

EXPOSE 1965

ENTRYPOINT ["./locus"]