Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#37 Docker for Calypso #66

Merged
merged 24 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6a32753
cangen simulation structure
tszwinglitw Oct 3, 2024
841b481
moved simulate into a separate binary
tszwinglitw Oct 3, 2024
a73fc9c
Merge remote-tracking branch 'origin' into 49-cangen-sim
tszwinglitw Oct 4, 2024
c1da996
added sim code genreation
tszwinglitw Oct 6, 2024
8a8d36d
improved new value generation
tszwinglitw Oct 6, 2024
67779d6
bug fixes
tszwinglitw Oct 8, 2024
27718b4
Merge remote-tracking branch 'origin' into 49-cangen-sim
tszwinglitw Oct 8, 2024
7ac5548
added struct for param passing, removed format and signed
tszwinglitw Oct 8, 2024
5265bff
fixed value initialization for boolean values
tszwinglitw Oct 8, 2024
75f4839
added rounding for nicer numbers and boolean cases
tszwinglitw Oct 8, 2024
8cdf281
updated submodule pointer
tszwinglitw Oct 8, 2024
6e4e8a3
ok cargo clippy
tszwinglitw Oct 8, 2024
368e769
fixed NaN values
tszwinglitw Oct 11, 2024
a8c58ac
limit retry attempts; refactoring and cleanup
tszwinglitw Oct 12, 2024
088aa8d
update embedded-base pointer
tszwinglitw Oct 13, 2024
dbc97f3
added Dockerfile
tszwinglitw Oct 13, 2024
f2e4720
added github action script
tszwinglitw Oct 20, 2024
900d445
update action script
tszwinglitw Oct 20, 2024
810bc37
update action script
tszwinglitw Oct 21, 2024
32f5f9c
update readme, action script
tszwinglitw Oct 22, 2024
f5f250f
Merge remote-tracking branch 'origin' into 49-cangen-sim
tszwinglitw Oct 24, 2024
aee078b
bump embedded base
jr1221 Oct 25, 2024
71fcd7c
make build more often
jr1221 Oct 25, 2024
2481ef6
amend when it builds
jr1221 Oct 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/calypso-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#
name: Create and publish Calypso docker image

on:
push:
branches: ['Develop']
path:
- "Dockerfile"
workflow_dispatch:

# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
jobs:
build-and-push-image:
runs-on: ubuntu-latest
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
#
steps:
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Checkout repository
uses: actions/checkout@v4
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
- name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- name: Build and push Docker image for Calypso
uses: docker/[email protected]
with:
context: ./
push: true
platforms: linux/arm64,linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# for caching
# cache-from: type=gha
# cache-to: type=gha,mode=max
# https://github.com/docker/build-push-action/issues/820
provenance: false
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM rust AS builder

WORKDIR /usr/src/calypso
COPY . .

RUN git submodule update --init
RUN apt-get update && apt-get install -y libssl-dev build-essential cmake
RUN cargo install --path .

FROM debian:bookworm-slim
RUN apt update
RUN apt install openssl -y

COPY --from=builder /usr/local/cargo/bin/calypso /usr/local/bin/calypso
COPY --from=builder /usr/local/cargo/bin/simulate /usr/local/bin/simulate

CMD ["simulate"]

# START WITH: sudo docker run -d --rm --network host calypso
2 changes: 1 addition & 1 deletion Embedded-Base
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,16 @@ Now view calypso interpret the can message and broadcast it on `mqttui`


### Simulation Mode
#### Run from build
- Same setup as above, then use the entry point `simulate` instead of `main`
- ```cargo run --bin simulate```
- ```cargo run --bin simulate -- -u localhost:1883```

#### Run from Docker
- ```docker pull ghcr.io/northeastern-electric-racing/calypso:Develop```
- ```docker run -d --rm --network host ghcr.io/northeastern-electric-racing/calypso:Develop```
- ```docker run -d --rm -e CALYPSO_SIREN_HOST_URL=127.0.0.1:1883 --network host ghcr.io/northeastern-electric-racing/calypso:Develop```



### Generate Proto
Expand Down
Loading