-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathDockerfile
More file actions
71 lines (54 loc) · 1.97 KB
/
Copy pathDockerfile
File metadata and controls
71 lines (54 loc) · 1.97 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
### For local builds ##########################################################
# IMPORTANT:
# This image intentionally builds on Debian bookworm (glibc 2.36).
# Do NOT switch the build stage to rust:<version> or newer distros,
# or the resulting binary will not run on stable Linux systems.
# ---- Build stage ------------------------------------------------------------
FROM debian:bookworm AS base
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
ca-certificates \
build-essential \
pkg-config \
protobuf-compiler \
libssl-dev && \
rm -rf /var/lib/apt/lists/*
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
ARG RUST_VERSION=1.91.0
RUN rustup toolchain install ${RUST_VERSION}
RUN rustup default ${RUST_VERSION}
FROM base AS build
WORKDIR /app
# copy source
# NOTE: if new modules are added to the Cargo workspaces, they must be added here.
COPY Cargo.toml Cargo.lock ./
COPY encoderfile ./encoderfile
COPY encoderfile-runtime ./encoderfile-runtime
COPY encoderfile-py ./encoderfile-py
# Build release binary.
RUN cargo build \
-p encoderfile \
-p encoderfile-runtime \
--release
# ---- Final stage ------------------------------------------------------------
FROM debian:bookworm-slim AS final
# Default working directory.
WORKDIR /opt/encoderfile
# ca-certificates for downloading base binaries
RUN apt-get update && apt-get install -y \
ca-certificates \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install binary into a standard PATH location.
COPY --from=build /app/target/release/encoderfile /usr/local/bin/encoderfile
RUN chmod +x /usr/local/bin/encoderfile
# Add documentation and license material.
RUN mkdir -p /usr/share/docs/encoderfile
COPY README.md THIRDPARTY.md LICENSE /usr/share/docs/encoderfile/
# smoke test
RUN /usr/local/bin/encoderfile version
# Default command entry.
ENTRYPOINT ["/usr/local/bin/encoderfile"]
CMD ["--help"]