generated from recmo/rust-service-template
-
Notifications
You must be signed in to change notification settings - Fork 35
/
Dockerfile
42 lines (31 loc) · 1.06 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
FROM debian:12 as build-env
WORKDIR /src
# Copy all the source files
# .dockerignore ignores the target dir
# This includes the rust-toolchain.toml
COPY . .
# Install dependencies
RUN apt-get update && \
apt-get install -y git curl build-essential libssl-dev texinfo libcap2-bin pkg-config
# TODO: Use a specific version of rustup
# Install rustup
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
# Set environment variables
ENV PATH="/root/.cargo/bin:${PATH}"
ENV RUSTUP_HOME="/root/.rustup"
ENV CARGO_HOME="/root/.cargo"
# Install the toolchain
RUN rustup component add cargo
# Build the sequencer
RUN cargo build --release
# cc variant because we need libgcc and others
FROM gcr.io/distroless/cc-debian12:nonroot
# Expose Prometheus
ENV PROMETHEUS="http://0.0.0.0:9998/metrics"
EXPOSE 9998/tcp
LABEL prometheus.io/scrape="true"
LABEL prometheus.io/port="9998"
LABEL prometheus.io/path="/metrics"
# Copy the sequencer binary
COPY --from=build-env --chown=0:10001 --chmod=454 /src/target/release/signup-sequencer /bin/signup-sequencer
ENTRYPOINT [ "/bin/signup-sequencer" ]