forked from eclipse-kuksa/kuksa.val.feeders
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
79 lines (55 loc) · 2.2 KB
/
Dockerfile
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
73
74
75
76
77
78
79
# /********************************************************************************
# * Copyright (c) 2022 Contributors to the Eclipse Foundation
# *
# * See the NOTICE file(s) distributed with this work for additional
# * information regarding copyright ownership.
# *
# * This program and the accompanying materials are made available under the
# * terms of the Apache License 2.0 which is available at
# * http://www.apache.org/licenses/LICENSE-2.0
# *
# * SPDX-License-Identifier: Apache-2.0
# ********************************************************************************/
# Build stage, to create a Virtual Environent
FROM --platform=$TARGETPLATFORM python:3.9-slim-bullseye as builder
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "-- Running on $BUILDPLATFORM, building for $TARGETPLATFORM"
RUN apt-get update -qqy && apt-get upgrade -qqy && apt-get install -qqy binutils g++
COPY . /
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN /opt/venv/bin/python3 -m pip install --upgrade pip \
&& pip3 install --no-cache-dir -r requirements.txt
RUN pip3 install wheel scons && pip3 install pyinstaller patchelf==0.17.0.0 staticx
# By default we use certificates and tokens from kuksa_certificates, so they must be included
RUN pyinstaller --collect-data kuksa_certificates --clean -F -s dbcfeeder.py
# --debug=imports
WORKDIR /dist
RUN staticx dbcfeeder dbcfeeder-exe
WORKDIR /data
COPY ./config/* ./config/
COPY ./mapping/ ./mapping/
COPY ./*.dbc ./candump*.log ./
# Runner stage, to copy in the virtual environment and the app
FROM scratch
LABEL org.opencontainers.image.source="https://github.com/eclipse/kuksa.val.feeders"
LABEL org.opencontainers.image.licenses="APACHE-2.0"
# needed as /dist/binary unpacks and runs from /tmp
WORKDIR /tmp
# optional volume mapping
WORKDIR /conf
WORKDIR /dist
COPY --from=builder /dist/dbcfeeder-exe .
COPY --from=builder /data/ ./
ENV PATH="/dist:$PATH"
# useful dumps about feeding values
ENV LOG_LEVEL="info"
# Vehicle Data Broker host:port
#ENV VDB_ADDRESS="localhost:55555"
# Override VDB_ADDRESS port if set
#ENV DAPR_GRPC_PORT="55555"
# VDB DAPR APP ID
ENV VEHICLEDATABROKER_DAPR_APP_ID=vehicledatabroker
ENV PYTHONUNBUFFERED=yes
ENTRYPOINT ["./dbcfeeder-exe"]