-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add container support for Ibeji #62
Merged
ashbeitz
merged 15 commits into
eclipse-ibeji:main
from
devkelley:devkelley/add_dockerfile
Oct 27, 2023
Merged
Changes from 8 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
35026ad
Add dockerfiles and supporting configuration to Ibeji
devkelley d229456
Merge remote-tracking branch 'origin/main' into devkelley/add_dockerfile
devkelley 571a590
removed uncessary build dependencies
devkelley 9720776
ignore devskim warnings
devkelley 7521736
resolve README comments
devkelley eb77b91
fixed typo
devkelley ca58387
set IBEJI_HOME environment variable in dockerfile
devkelley b262be2
Update get_uri to return what env variable the failure was for
devkelley d59844e
fix devskim err
devkelley c0c0b31
attempt 2 of fixing devskim
devkelley 6e0e3d5
change var name as ignoring creates a fmt error
devkelley 960adcd
remove commented feature flag
devkelley 6a63d81
changed const to variables
devkelley c4f0aef
fix feature flag
devkelley 8ea0c5a
Rearrange README
devkelley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.git | ||
.gitattributes | ||
.gitignore | ||
.dockerignore | ||
|
||
debug/ | ||
target/ | ||
|
||
.devcontainer/ | ||
.github/ | ||
devops/ | ||
docs/ | ||
tools/ | ||
|
||
Cargo.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT license. | ||
# SPDX-License-Identifier: MIT | ||
|
||
# syntax=docker/dockerfile:1 | ||
|
||
# Comments are provided throughout this file to help you get started. | ||
# If you need more help, visit the Dockerfile reference guide at | ||
# https://docs.docker.com/engine/reference/builder/ | ||
|
||
################################################################################ | ||
# Create a stage for building the application. | ||
|
||
ARG RUST_VERSION=1.72.1 | ||
FROM docker.io/library/rust:${RUST_VERSION}-slim-bullseye AS build | ||
ARG APP_NAME=invehicle-digital-twin | ||
WORKDIR /sdv | ||
devkelley marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
COPY ./ . | ||
|
||
# Add Build dependencies. | ||
RUN apt update && apt upgrade -y && apt install -y protobuf-compiler | ||
|
||
# Check that APP_NAME argument is valid. | ||
RUN sanitized=$(echo "${APP_NAME}" | tr -dc '^[a-zA-Z_0-9-]+$'); \ | ||
[ "$sanitized" = "${APP_NAME}" ] || { \ | ||
echo "ARG 'APP_NAME' is invalid. APP_NAME='${APP_NAME}' sanitized='${sanitized}'"; \ | ||
exit 1; \ | ||
} | ||
|
||
# Build the application with the 'containerize' feature. | ||
RUN cargo build --release -p "${APP_NAME}" --features "containerize" | ||
|
||
# Copy the built application to working directory. | ||
RUN cp ./target/release/"${APP_NAME}" /sdv/service | ||
|
||
################################################################################ | ||
# Create a new stage for running the application that contains the minimal | ||
# runtime dependencies for the application. This often uses a different base | ||
# image from the build stage where the necessary files are copied from the build | ||
# stage. | ||
# | ||
# The example below uses the debian bullseye image as the foundation for running the app. | ||
# By specifying the "bullseye-slim" tag, it will also use whatever happens to be the | ||
# most recent version of that tag when you build your Dockerfile. If | ||
# reproducability is important, consider using a digest | ||
# (e.g., debian@sha256:ac707220fbd7b67fc19b112cee8170b41a9e97f703f588b2cdbbcdcecdd8af57). | ||
FROM docker.io/library/debian:bullseye-slim AS final | ||
|
||
# Create a non-privileged user that the app will run under. | ||
# See https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user | ||
ARG UID=10001 | ||
RUN adduser \ | ||
--disabled-password \ | ||
--gecos "" \ | ||
--home "/nonexistent" \ | ||
--shell "/sbin/nologin" \ | ||
--no-create-home \ | ||
--uid "${UID}" \ | ||
appuser | ||
USER appuser | ||
|
||
WORKDIR /sdv | ||
|
||
# Set home environment variable. | ||
ENV IBEJI_HOME=/sdv | ||
|
||
# Copy the executable from the "build" stage. | ||
COPY --from=build /sdv/service /sdv/ | ||
|
||
# Copy configuration for service. | ||
COPY --from=build /sdv/container/config/standalone/ /sdv/ | ||
|
||
# Expose the port that the application listens on. | ||
EXPOSE 5010 | ||
|
||
# What the container should run when it is started. | ||
CMD ["/sdv/service"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT license. | ||
# SPDX-License-Identifier: MIT | ||
|
||
# syntax=docker/dockerfile:1 | ||
|
||
# Comments are provided throughout this file to help you get started. | ||
# If you need more help, visit the Dockerfile reference guide at | ||
# https://docs.docker.com/engine/reference/builder/ | ||
|
||
################################################################################ | ||
# Create a stage for building the application. | ||
|
||
ARG RUST_VERSION=1.72.1 | ||
FROM docker.io/library/rust:${RUST_VERSION}-slim-bullseye AS build | ||
ARG APP_NAME=invehicle-digital-twin | ||
WORKDIR /sdv | ||
|
||
COPY ./ . | ||
|
||
# Add Build dependencies. | ||
RUN apt update && apt upgrade -y && apt install -y protobuf-compiler | ||
|
||
# Check that APP_NAME argument is valid. | ||
RUN sanitized=$(echo "${APP_NAME}" | tr -dc '^[a-zA-Z_0-9-]+$'); \ | ||
[ "$sanitized" = "${APP_NAME}" ] || { \ | ||
echo "ARG 'APP_NAME' is invalid. APP_NAME='${APP_NAME}' sanitized='${sanitized}'"; \ | ||
exit 1; \ | ||
} | ||
|
||
# Build the application with the 'containerize' feature. | ||
RUN cargo build --release -p "${APP_NAME}" --features "containerize managed_subscribe" | ||
|
||
# Copy the built application to working directory. | ||
RUN cp ./target/release/"${APP_NAME}" /sdv/service | ||
|
||
################################################################################ | ||
# Create a new stage for running the application that contains the minimal | ||
# runtime dependencies for the application. This often uses a different base | ||
# image from the build stage where the necessary files are copied from the build | ||
# stage. | ||
# | ||
# The example below uses the debian bullseye image as the foundation for running the app. | ||
# By specifying the "bullseye-slim" tag, it will also use whatever happens to be the | ||
# most recent version of that tag when you build your Dockerfile. If | ||
# reproducability is important, consider using a digest | ||
# (e.g., debian@sha256:ac707220fbd7b67fc19b112cee8170b41a9e97f703f588b2cdbbcdcecdd8af57). | ||
FROM docker.io/library/debian:bullseye-slim AS final | ||
|
||
# Create a non-privileged user that the app will run under. | ||
# See https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user | ||
ARG UID=10001 | ||
RUN adduser \ | ||
--disabled-password \ | ||
--gecos "" \ | ||
--home "/nonexistent" \ | ||
--shell "/sbin/nologin" \ | ||
--no-create-home \ | ||
--uid "${UID}" \ | ||
appuser | ||
USER appuser | ||
|
||
WORKDIR /sdv | ||
|
||
# Set home environment variable. | ||
ENV IBEJI_HOME=/sdv | ||
|
||
# Copy the executable from the "build" stage. | ||
COPY --from=build /sdv/service /sdv/ | ||
|
||
# Copy configuration for service. | ||
COPY --from=build /sdv/container/config/integrated/ /sdv/ | ||
|
||
# Expose the port that the application listens on. | ||
EXPOSE 5010 | ||
|
||
# What the container should run when it is started. | ||
CMD ["/sdv/service"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT license. | ||
# SPDX-License-Identifier: MIT | ||
|
||
# DNS name used by the container to communicate with host. | ||
HOST_GATEWAY=host.docker.internal | ||
|
||
# Alias for localhost to be replaced by HOST_GATEWAY if run in a container. | ||
LOCALHOST_ALIAS=0.0.0.0 |
11 changes: 11 additions & 0 deletions
11
container/config/integrated/invehicle_digital_twin_settings.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# | ||
# In-Vehicle Digital Twin Service Settings | ||
# | ||
|
||
# The IP address and port number that the in-vehicle digital twin service listens on for digital twin requests. | ||
# Example: "0.0.0.0:5010" | ||
invehicle_digital_twin_authority: "0.0.0.0:5010" | ||
|
||
# The URL that the Chariott service listens on for requests. | ||
# If you wish to use Chariott, then uncomment this setting. | ||
chariott_uri: "http://0.0.0.0:50000" # DevSkim: ignore DS137138 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a way for this to be controlled by the rust-toolchain.toml file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not in a simple way, there may be a way to copy the value from the rust-toolchain.toml file or install rust manually but I am not sure it is worth it at this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this goes in as is, then let's make it a high priority follow-up to address this. I have some ideas on how to do this. Perhaps we can have a 15 min brainstorming on the best way to do it and to make sure that the solution gets into all of our software components.