Skip to content

Commit 122852d

Browse files
author
Nicolas Pernoud
committed
feat: dev container with c library and tpm emulator
Signed-off-by: Nicolas Pernoud <nicolas.pernoud@stormshield.eu>
1 parent f18602b commit 122852d

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
FROM rust:latest
2+
3+
RUN apt -y update && apt -y install \
4+
autoconf-archive \
5+
libcmocka0 \
6+
libcmocka-dev \
7+
procps \
8+
iproute2 \
9+
build-essential \
10+
git \
11+
pkg-config \
12+
gcc \
13+
libtool \
14+
automake \
15+
libssl-dev \
16+
uthash-dev \
17+
autoconf \
18+
doxygen \
19+
libjson-c-dev \
20+
libini-config-dev \
21+
libcurl4-openssl-dev \
22+
uuid-dev \
23+
libltdl-dev \
24+
libusb-1.0-0-dev \
25+
libftdi-dev \
26+
clang
27+
28+
WORKDIR /build
29+
ADD . /build
30+
31+
# TPM Lib
32+
RUN git clone --depth 1 --branch 4.1.3 https://github.com/tpm2-software/tpm2-tss.git && \
33+
cd tpm2-tss && \
34+
./bootstrap && \
35+
./configure --prefix=/usr && \
36+
make -j5 && \
37+
make install

.devcontainer/devcontainer.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "Development environment",
3+
"dockerComposeFile": "docker-compose.yml",
4+
"service": "app",
5+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
6+
"customizations": {
7+
"vscode": {
8+
"extensions": [
9+
"1YiB.rust-bundle",
10+
"fill-labs.dependi"
11+
],
12+
"settings": {
13+
"remote.autoForwardPorts": false,
14+
"editor.formatOnSave": true
15+
}
16+
}
17+
}
18+
}

.devcontainer/docker-compose.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
services:
2+
app:
3+
hostname: app
4+
build:
5+
context: .
6+
dockerfile: Dockerfile
7+
volumes:
8+
- ../..:/workspaces:cached
9+
command: sleep infinity
10+
network_mode: host
11+
environment:
12+
TPM2TOOLS_TCTI: mssim:host=localhost,port=2321
13+
deploy:
14+
resources:
15+
limits:
16+
cpus: '4.0'
17+
memory: 16G
18+
19+
tpm:
20+
image: tpmdev/tpm2-runtime
21+
network_mode: host
22+
restart: unless-stopped
23+
environment:
24+
TPM2TOOLS_TCTI: mssim:host=localhost,port=2321
25+
command: /bin/bash -c "tpm_server >/dev/null & sleep 1; tpm2_startup -c; sleep infinity"
26+

0 commit comments

Comments
 (0)