Skip to content

Commit

Permalink
✨ add server image
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Feria <[email protected]>
  • Loading branch information
carlosthe19916 committed Mar 2, 2025
1 parent 0fbfb90 commit 919d9e5
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/image-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ concurrency:
cancel-in-progress: true

jobs:
server-image-build:
uses: project-openubl/release-tools/.github/workflows/build-push-images.yaml@main
with:
registry: "ghcr.io"
image_name: "${{ github.repository_owner }}/openubl-server"
containerfile: "./Dockerfile.server"
architectures: '[ "amd64", "arm64" ]'
secrets:
registry_username: ${{ github.actor }}
registry_password: ${{ secrets.GITHUB_TOKEN }}

ui-image-build:
uses: project-openubl/release-tools/.github/workflows/build-push-images.yaml@main
with:
Expand Down
40 changes: 40 additions & 0 deletions Dockerfile.server
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"]

0 comments on commit 919d9e5

Please sign in to comment.