Skip to content

Commit

Permalink
RTI dockerfile support for multi-architecture builds (#464)
Browse files Browse the repository at this point in the history
* RTI dockerfile support multiarchitecture builds. Use build stage to reduce image size by 20x. Add maintainer documentation to Dockerfile.

* Add smoke test for multi-arch docker build

* Update core/federated/RTI/rti.Dockerfile

Co-authored-by: Shulu Li <[email protected]>

* Update core/federated/RTI/rti.Dockerfile

Co-authored-by: Shulu Li <[email protected]>

* Update core/federated/RTI/rti.Dockerfile

---------

Co-authored-by: Marten Lohstroh <[email protected]>
Co-authored-by: Shulu Li <[email protected]>
  • Loading branch information
3 people authored Aug 2, 2024
1 parent c81b644 commit 4026514
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/build-rti.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,32 @@ on:
workflow_call:

jobs:
run:
native-build:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}

steps:
- name: Check out reactor-c repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Build the RTI with AUTH=OFF
run: .github/scripts/build-rti.sh -DAUTH=OFF
- name: Build the RTI with AUTH=ON
run: .github/scripts/build-rti.sh -DAUTH=ON

docker-build:
runs-on: ubuntu-latest
steps:
- name: Check out reactor-c repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v6
with:
file: ./core/federated/RTI/rti.Dockerfile
context: .
platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/riscv64
push: false
tags: lflang/rti:latest
17 changes: 13 additions & 4 deletions core/federated/RTI/rti.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Docker file for building the image of the rti
FROM alpine:latest
ARG BASEIMAGE=alpine:latest
FROM ${BASEIMAGE} as builder
COPY . /lingua-franca
WORKDIR /lingua-franca/core/federated/RTI
RUN set -ex && apk add --no-cache gcc musl-dev cmake make && \
Expand All @@ -9,5 +9,14 @@ RUN set -ex && apk add --no-cache gcc musl-dev cmake make && \
make && \
make install

# Use ENTRYPOINT not CMD so that command-line arguments go through
ENTRYPOINT ["RTI"]
WORKDIR /lingua-franca

# application stage
FROM ${BASEIMAGE} as app
LABEL maintainer="lf-lang"
LABEL source="https://github.com/lf-lang/reactor-c/tree/main/core/federated/RTI"
COPY --from=builder /usr/local/bin/RTI /usr/local/bin/RTI

WORKDIR /lingua-franca

ENTRYPOINT ["/usr/local/bin/RTI"]

0 comments on commit 4026514

Please sign in to comment.