Skip to content

Commit c184760

Browse files
committed
docker: Add helper recipe
Using official rust's docker image as base. Usage is straight forward: ``` docker run astarte-device-sdk-rust:latest run --example simple -- \ --credentials-secret $credentialssecret \ --device-id $deviceid \ --pairing-url $pairingurl \ --realm $realm ``` For the record it can be rebased on ubuntu:21.10 (and cargo should be added to base packages) My distro RUST setup is not running it out of the box so I used a more recent one. For the record the observed error was: error[E0599]: no variant or associated item named `OutOfMemory` found for enum `ErrorKind` in the current scope -> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-core-0.5.10/src/sqlite/connection/establish.rs:107:32 Install example is needed because there is no default installation rule: error: there is nothing to install in `astarte_sdk v0.1.0 (/local/src/astarte-device-sdk-rust)`, because it has no binaries Forwarded: #31 Relate-to: #20 Signed-off-by: Philippe Coval <philippe.coval@astrolabe.coop>
1 parent f0c6fe5 commit c184760

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

.dockerignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright 2022 Huawei OSTC
2+
#
3+
# SPDX-License-Identifier: CC0-1.0
4+
5+
#.dockerignore
6+
.git/
7+
#.gitignore
8+
/target
9+
Cargo.lock

Dockerfile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/echo docker build . -f
2+
# -*- coding: utf-8 -*-
3+
# Copyright 2022 Huawei OTC
4+
#
5+
# SPDX-License-Identifier: Apache-2.0
6+
7+
FROM rust:bullseye
8+
LABEL maintainer="Philippe Coval (philippe.coval@astrolabe.coop)"
9+
10+
RUN echo "#log: Setup system" \
11+
&& set -x \
12+
&& apt-get update \
13+
&& apt-get install -y \
14+
--no-install-recommends \
15+
ca-certificates \
16+
libssl-dev \
17+
pkg-config \
18+
&& apt-get upgrade -y \
19+
&& apt-get clean \
20+
&& rm -rf /var/lib/apt/lists/* \
21+
&& date -u
22+
23+
ARG project=astarte-device-sdk-rust
24+
ARG workdir="/local/src/${project}"
25+
26+
COPY . "${workdir}/"
27+
WORKDIR "${workdir}"
28+
RUN echo "#log: ${project}: Building sources" \
29+
&& set -x \
30+
&& export OPENSSL_NO_VENDOR=1 \
31+
&& cargo build \
32+
&& cargo install --path . || echo "warning: no default install rule" \
33+
&& cargo install --examples --path . \
34+
&& date -u
35+
36+
WORKDIR "${workdir}"
37+
ENTRYPOINT [ "cargo" ]
38+
CMD [ "run", "--example", "simple", "--" , "--help" ]

0 commit comments

Comments
 (0)