-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
72 lines (62 loc) · 2.32 KB
/
Copy pathDockerfile
File metadata and controls
72 lines (62 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
FROM python:3.11-slim AS libcsp-vector-env
ARG LIBCSP_REPO=https://github.com/libcsp/libcsp.git
ARG LIBCSP_TAG=v2.1
ARG LIBCSP_COMMIT=48f7fb0
ENV DEBIAN_FRONTEND=noninteractive \
LIBCSP_REPO=${LIBCSP_REPO} \
LIBCSP_TAG=${LIBCSP_TAG} \
LIBCSP_COMMIT=${LIBCSP_COMMIT}
WORKDIR /app
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
can-utils \
git \
iproute2 \
kmod \
libsocketcan-dev \
meson \
ninja-build \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
# The tag is checked against the expected short commit so a moved or mistyped
# upstream tag fails the build before any vectors can be generated from it.
RUN git clone --branch "${LIBCSP_TAG}" --depth 1 "${LIBCSP_REPO}" /opt/libcsp \
&& cd /opt/libcsp \
&& test "$(git rev-parse --short=7 HEAD)" = "${LIBCSP_COMMIT}" \
&& meson setup build \
--default-library=static \
-Denable_reproducible_builds=true \
-Duse_rtable=true \
-Dversion=2 \
&& meson compile -C build
COPY tests/golden_vectors/src/csp_client.c /app/tests/golden_vectors/src/csp_client.c
# Keep the helper under /opt as the runtime source of truth. The Compose bind
# mount hides image-time /app contents, so the entrypoint copies this binary into
# the mounted repository on container start.
RUN mkdir -p /opt/cubesat_testbed/bin /app/tests/golden_vectors/bin \
&& cc \
-std=gnu11 \
-Wall \
-Wextra \
-Wpedantic \
-Werror \
-I/opt/libcsp/include \
-I/opt/libcsp/src \
-I/opt/libcsp/build/include \
/app/tests/golden_vectors/src/csp_client.c \
/opt/libcsp/build/libcsp.a \
-lsocketcan \
-lpthread \
-lrt \
-lutil \
-o /opt/cubesat_testbed/bin/csp_client \
&& cp /opt/cubesat_testbed/bin/csp_client /app/tests/golden_vectors/bin/csp_client
COPY tests/golden_vectors/scripts/vector-entrypoint.sh /usr/local/bin/cubesat-vector-entrypoint
RUN chmod +x /usr/local/bin/cubesat-vector-entrypoint
# Include a repository snapshot for direct `docker run` use; Compose still mounts
# the live checkout at /app when generating fixtures.
COPY . /app
ENTRYPOINT ["/usr/local/bin/cubesat-vector-entrypoint"]
CMD ["sleep", "infinity"]