-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathDockerfile.server
40 lines (34 loc) · 1.58 KB
/
Dockerfile.server
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
######################################################################
# 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"]