-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
102 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# ------------------------------------------------------------------------------ | ||
# Build Stage | ||
# ------------------------------------------------------------------------------ | ||
|
||
FROM registry.access.redhat.com/ubi8/ubi:8.7 as limitador-build | ||
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true | ||
|
||
ARG RUSTC_VERSION=1.72.0 | ||
|
||
# the powertools repo is required for protobuf-c and protobuf-devel | ||
RUN dnf -y --setopt=install_weak_deps=False --setopt=tsflags=nodocs install \ | ||
http://mirror.centos.org/centos/8-stream/BaseOS/`arch`/os/Packages/centos-gpg-keys-8-6.el8.noarch.rpm \ | ||
http://mirror.centos.org/centos/8-stream/BaseOS/`arch`/os/Packages/centos-stream-repos-8-6.el8.noarch.rpm \ | ||
&& dnf -y --setopt=install_weak_deps=False --setopt=tsflags=nodocs install epel-release \ | ||
&& dnf config-manager --set-enabled powertools | ||
|
||
RUN yum -y clean all | ||
RUN dnf install --nodocs --assumeyes gcc-c++-aarch64-linux-gnu binutils-aarch64-linux-gnu | ||
RUN dnf install --nodocs --assumeyes perl-IPC-Cmd | ||
|
||
RUN PKGS="protobuf-c protobuf-devel git clang kernel-headers" \ | ||
&& dnf install --nodocs --assumeyes $PKGS \ | ||
&& rpm --verify --nogroup --nouser $PKGS \ | ||
&& yum -y clean all | ||
|
||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path --profile minimal --default-toolchain ${RUSTC_VERSION} -c rustfmt -y | ||
RUN source $HOME/.cargo/env \ | ||
&& rustup target add aarch64-unknown-linux-gnu | ||
RUN source $HOME/.cargo/env \ | ||
&& rustup toolchain install stable-aarch64-unknown-linux-gnu | ||
|
||
WORKDIR /usr/src/limitador | ||
|
||
ARG GITHUB_SHA | ||
ENV GITHUB_SHA=${GITHUB_SHA:-unknown} | ||
ENV RUSTFLAGS="-C target-feature=-crt-static" | ||
|
||
COPY . . | ||
|
||
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \ | ||
CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc \ | ||
CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++ | ||
|
||
RUN source $HOME/.cargo/env \ | ||
&& cargo build --release --target aarch64-unknown-linux-gnu | ||
|
||
# ------------------------------------------------------------------------------ | ||
# Run Stage | ||
# ------------------------------------------------------------------------------ | ||
|
||
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7 | ||
|
||
# shadow-utils is required for `useradd` | ||
RUN PKGS="libgcc libstdc++ shadow-utils" \ | ||
&& microdnf --assumeyes install --nodocs $PKGS \ | ||
&& rpm --verify --nogroup --nouser $PKGS \ | ||
&& microdnf -y clean all | ||
RUN useradd -u 1000 -s /bin/sh -m -d /home/limitador limitador | ||
|
||
WORKDIR /home/limitador/bin/ | ||
ENV PATH="/home/limitador/bin:${PATH}" | ||
|
||
COPY --from=limitador-build /usr/src/limitador/limitador-server/examples/limits.yaml ../ | ||
COPY --from=limitador-build /usr/src/limitador/target/aarch64-unknown-linux-gnu/release/limitador-server ./limitador-server | ||
|
||
RUN chown -R limitador:root /home/limitador \ | ||
&& chmod -R 750 /home/limitador | ||
|
||
USER limitador | ||
|
||
CMD ["limitador-server"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters