-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile.ppc64le
More file actions
90 lines (65 loc) · 2.77 KB
/
Dockerfile.ppc64le
File metadata and controls
90 lines (65 loc) · 2.77 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
ARG UBI_MINIMAL_BASE_IMAGE=registry.access.redhat.com/ubi9/ubi-minimal
ARG UBI_BASE_IMAGE_TAG=latest
ARG PROTOC_VERSION=29.3
ARG CONFIG_FILE=config/config.yaml
## Rust builder ################################################################
FROM ${UBI_MINIMAL_BASE_IMAGE}:${UBI_BASE_IMAGE_TAG} AS rust-builder
ARG PROTOC_VERSION
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
# Install dependencies
RUN microdnf --disableplugin=subscription-manager -y update && \
microdnf install --disableplugin=subscription-manager -y \
unzip \
ca-certificates \
openssl-devel \
gcc \
cmake \
clang \
clang-devel && \
microdnf clean all
COPY rust-toolchain.toml rust-toolchain.toml
# Install rustup [needed for latest Rust versions]
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain none -y --no-modify-path && \
. "$HOME/.cargo/env" && \
rustup install && \
rustup component add rustfmt
# Set PATH so rustc, cargo, rustup are available
ENV PATH="/root/.cargo/bin:${PATH}"
# Install protoc, no longer included in prost crate
RUN cd /tmp && \
curl -L -O https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-ppcle_64.zip; \
unzip protoc-*.zip -d /usr/local && \
rm protoc-*.zip
ENV LIBCLANG_PATH=/usr/lib64/
WORKDIR /app
COPY rust-toolchain.toml rust-toolchain.toml
RUN rustup component add rustfmt
## Orchestrator builder #########################################################
FROM rust-builder AS fms-guardrails-orchestr8-builder
ARG CONFIG_FILE=config/config.yaml
COPY build.rs *.toml Cargo.lock LICENSE /app/
COPY ${CONFIG_FILE} /app/config/config.yaml
COPY protos/ /app/protos/
COPY src/ /app/src/
COPY tests/ /app/tests/
WORKDIR /app
# TODO: Make releases via cargo-release
RUN cargo build --release
# Copy test resources required for executing unit tests
COPY tests/resources /app/tests/resources
RUN cargo test
## Release Image ################################################################
FROM ${UBI_MINIMAL_BASE_IMAGE}:${UBI_BASE_IMAGE_TAG} AS fms-guardrails-orchestr8-release
ARG CONFIG_FILE=config/config.yaml
COPY --from=fms-guardrails-orchestr8-builder /app/target/release/fms-guardrails-orchestr8 /app/bin/
COPY ${CONFIG_FILE} /app/config/config.yaml
RUN microdnf install -y --disableplugin=subscription-manager shadow-utils compat-openssl11 && \
microdnf clean all --disableplugin=subscription-manager
RUN groupadd --system orchestr8 --gid 1001 && \
adduser --system --uid 1001 --gid 0 --groups orchestr8 \
--create-home --home-dir /app --shell /sbin/nologin \
--comment "FMS Orchestrator User" orchestr8
USER orchestr8
HEALTHCHECK NONE
ENV ORCHESTRATOR_CONFIG=/app/config/config.yaml
CMD ["/app/bin/fms-guardrails-orchestr8"]