-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
47 lines (29 loc) · 1.09 KB
/
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
46
47
# ------------------------------------------------------------------------------
# Cargo Build Stage
# ------------------------------------------------------------------------------
FROM rust:1.50 as cargo-build
RUN apt-get update
RUN apt-get install libclang-dev clang cmake libxxhash-dev -y
WORKDIR /usr/src/sfss
COPY Cargo.toml Cargo.toml
RUN mkdir src/
RUN echo "fn main() {println!(\"if you see this, the build broke\")}" > src/main.rs
RUN cargo build --release
RUN rm -f target/release/deps/sfss*
COPY . .
RUN cargo build --release
# ------------------------------------------------------------------------------
# Final Stage
# ------------------------------------------------------------------------------
FROM debian:buster-slim
RUN useradd --shell /bin/sh --uid 1024 sfss
RUN apt-get update
RUN apt-get install libclang-dev libxxhash-dev -y
WORKDIR /home/sfss/bin/
RUN mkdir -p /var/sfss && chown sfss:sfss /var/sfss
RUN mkdir -p /tmp/sfss && chown sfss:sfss /tmp/sfss
COPY --from=cargo-build /usr/src/sfss/target/release/sfss .
RUN chown sfss:sfss sfss
EXPOSE 8000
USER sfss
CMD ["./sfss"]