-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into refine-actions
- Loading branch information
Showing
11 changed files
with
382 additions
and
40 deletions.
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
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
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
18 changes: 18 additions & 0 deletions
18
...mart_trailer_use_case/digital_twin_providers/trailer_fridge_connected_provider/Cargo.toml
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,18 @@ | ||
[package] | ||
name = "trailer_fridge_connected_provider" | ||
version = "0.1.0" | ||
edition = "2021" | ||
license = "MIT" | ||
|
||
[dependencies] | ||
digital-twin-model = { path = "../../digital-twin-model" } | ||
digital_twin_providers_common = { path = "../common" } | ||
env_logger = { workspace = true } | ||
interfaces = { path = "../../../../proto_build"} | ||
log = { workspace = true } | ||
serde = { workspace = true } | ||
serde_derive = { workspace = true } | ||
serde_json = { workspace = true } | ||
smart_trailer_interfaces = { path = "../../proto_build" } | ||
tokio = { workspace = true, features = ["macros", "rt-multi-thread", "signal"] } | ||
tonic = { workspace = true } |
73 changes: 73 additions & 0 deletions
73
...mart_trailer_use_case/digital_twin_providers/trailer_fridge_connected_provider/Dockerfile
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,73 @@ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT license. | ||
# SPDX-License-Identifier: MIT | ||
|
||
# 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=trailer_fridge_connected_provider | ||
# Add Build dependencies. | ||
RUN apt update -y && apt upgrade -y && apt install -y \ | ||
cmake \ | ||
libssl-dev \ | ||
pkg-config \ | ||
protobuf-compiler | ||
|
||
WORKDIR /sdv | ||
|
||
COPY ./ . | ||
|
||
|
||
# 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 | ||
RUN --mount=type=cache,target=./target/release/ cargo build --release --bin "${APP_NAME}" && \ | ||
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 | ||
|
||
# Copy the executable from the "build" stage. | ||
COPY --from=build /sdv/service /sdv/ | ||
|
||
# Expose the port that the application listens on. | ||
EXPOSE 4020 | ||
|
||
# What the container should run when it is started. | ||
CMD ["/sdv/service"] |
Oops, something went wrong.