forked from project-openubl/xhandler-rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Carlos Feria <[email protected]>
- Loading branch information
1 parent
0fbfb90
commit 919d9e5
Showing
2 changed files
with
51 additions
and
0 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
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,40 @@ | ||
###################################################################### | ||
# UI | ||
###################################################################### | ||
FROM registry.access.redhat.com/ubi9/nodejs-22:latest AS ui-source | ||
USER 1001 | ||
COPY --chown=1001 . . | ||
RUN cd server/ui/ && \ | ||
npm install -g npm@9 && \ | ||
npm clean-install --ignore-scripts && npm run build && npm run dist && \ | ||
rm -rf node_modules | ||
|
||
###################################################################### | ||
# Build server | ||
###################################################################### | ||
FROM registry.access.redhat.com/ubi9/ubi:latest AS server-builder | ||
|
||
# Dependencies | ||
RUN dnf install -y libxml2-devel openssl-devel gcc | ||
|
||
RUN mkdir /stage/ && \ | ||
dnf install --installroot /stage/ --setop install_weak_deps=false --nodocs -y zlib openssl && \ | ||
dnf clean all --installroot /stage/ | ||
|
||
# Setup Rust | ||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
ENV PATH=${PATH}:/root/.cargo/bin | ||
RUN rustup target add $(uname -m)-unknown-linux-gnu | ||
|
||
# Build source code | ||
COPY --from=ui-source /opt/app-root/src/ /code/openubl/ | ||
RUN cd /code/openubl/ && \ | ||
cargo build --no-default-features --release --target=$(uname -m)-unknown-linux-gnu && \ | ||
find /code/openubl/target/ -name "server" -exec cp -av {} /stage/usr/local/bin \; | ||
|
||
###################################################################### | ||
# Builder runner | ||
###################################################################### | ||
FROM registry.access.redhat.com/ubi9/ubi-micro:latest AS server-runner | ||
COPY --from=server-builder /stage/ . | ||
ENTRYPOINT ["/usr/local/bin/server"] |