Skip to content

Commit 4589e00

Browse files
✨ add server image (#444)
Signed-off-by: Carlos Feria <[email protected]>
1 parent 0fbfb90 commit 4589e00

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

.github/workflows/image-build.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@ concurrency:
1414
cancel-in-progress: true
1515

1616
jobs:
17+
server-image-build:
18+
uses: project-openubl/release-tools/.github/workflows/build-push-images.yaml@main
19+
with:
20+
registry: "ghcr.io"
21+
image_name: "${{ github.repository_owner }}/openubl-server"
22+
containerfile: "./Dockerfile.server"
23+
architectures: '[ "amd64", "arm64" ]'
24+
secrets:
25+
registry_username: ${{ github.actor }}
26+
registry_password: ${{ secrets.GITHUB_TOKEN }}
27+
1728
ui-image-build:
1829
uses: project-openubl/release-tools/.github/workflows/build-push-images.yaml@main
1930
with:

Dockerfile.server

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
######################################################################
2+
# UI
3+
######################################################################
4+
FROM registry.access.redhat.com/ubi9/nodejs-22:latest AS ui-source
5+
USER 1001
6+
COPY --chown=1001 . .
7+
RUN cd server/ui/ && \
8+
npm install -g npm@9 && \
9+
npm clean-install --ignore-scripts && npm run build && npm run dist && \
10+
rm -rf node_modules
11+
12+
######################################################################
13+
# Build server
14+
######################################################################
15+
FROM registry.access.redhat.com/ubi9/ubi:latest AS server-builder
16+
17+
# Dependencies
18+
RUN dnf install -y libxml2-devel openssl-devel gcc
19+
20+
RUN mkdir /stage/ && \
21+
dnf install --installroot /stage/ --setop install_weak_deps=false --nodocs -y zlib openssl && \
22+
dnf clean all --installroot /stage/
23+
24+
# Setup Rust
25+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
26+
ENV PATH=${PATH}:/root/.cargo/bin
27+
RUN rustup target add $(uname -m)-unknown-linux-gnu
28+
29+
# Build source code
30+
COPY --from=ui-source /opt/app-root/src/ /code/openubl/
31+
RUN cd /code/openubl/ && \
32+
cargo build --no-default-features --release --target=$(uname -m)-unknown-linux-gnu && \
33+
find /code/openubl/target/ -name "server" -exec cp -av {} /stage/usr/local/bin \;
34+
35+
######################################################################
36+
# Builder runner
37+
######################################################################
38+
FROM registry.access.redhat.com/ubi9/ubi-micro:latest AS server-runner
39+
COPY --from=server-builder /stage/ .
40+
ENTRYPOINT ["/usr/local/bin/server"]

0 commit comments

Comments
 (0)