-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathDockerfile-edge
60 lines (46 loc) · 2.56 KB
/
Dockerfile-edge
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
# syntax = docker/dockerfile:experimental
# Here is the build image
FROM ubuntu:22.04 as basebuilder
ARG DEBIAN_FRONTEND="noninteractive"
ENV TZ="Etc/UTC"
RUN apt-get update && apt-get install --no-install-recommends -y pkg-config gpg gpg-agent software-properties-common && add-apt-repository ppa:deadsnakes/ppa && apt-get update && \
apt-get install --no-install-recommends -y python3.12 python3.12-dev python3.12-venv python3-pip python3-wheel build-essential && \
apt-get install --no-install-recommends -y libpq-dev libffi-dev libssl-dev rustc cargo libjpeg-dev zlib1g-dev && \
apt-get clean && rm -rf /var/lib/apt/lists/*
FROM basebuilder as builder
COPY . vwsfriend
RUN python3.12 -m venv /opt/venv
# Make sure we use the virtualenv:
ENV PATH="/opt/venv/bin:$PATH"
WORKDIR ./vwsfriend/
RUN pip3 install --no-cache-dir wheel
# This line is a workaround necessary for linux/arm/v7 architecture that has a bug with qemu: https://github.com/rust-lang/cargo/issues/8719
# RUN --security=insecure mkdir -p /root/.cargo/registry/index && chmod 777 /root/.cargo/registry/index && mount -t tmpfs none /root/.cargo/registry/index && pip3 install --no-cache-dir cryptography
RUN pip3 install --no-cache-dir -r requirements.txt
RUN pip3 install --no-cache-dir -r mqtt_extra_requirements.txt
RUN pip3 install --no-cache-dir .
FROM ubuntu:22.04 AS baserunner
ARG DEBIAN_FRONTEND="noninteractive"
RUN apt-get update && apt-get install --no-install-recommends -y gpg gpg-agent software-properties-common && add-apt-repository ppa:deadsnakes/ppa && apt-get update && \
apt-get install --no-install-recommends -y python3.12 python3.12-venv wget && \
apt-get install --no-install-recommends -y libpq5 libjpeg8 zlib1g postgresql-client && \
apt-get clean && rm -rf /var/lib/apt/lists/*
FROM baserunner AS runner-image
ARG DEBIAN_FRONTEND="noninteractive"
ENV VWSFRIEND_USERNAME=
ENV VWSFRIEND_PASSWORD=
ENV VWSFRIEND_PORT=4000
ENV WECONNECT_USER=
ENV WECONNECT_PASSWORD=
ENV WECONNECT_SPIN=
ENV WECONNECT_INTERVAL=300
ENV ADDITIONAL_PARAMETERS=
ENV DATABASE_URL=
COPY --from=builder /opt/venv /opt/venv
ENV VIRTUAL_ENV=/opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN mkdir -p /config
# make sure all messages always reach console
ENV PYTHONUNBUFFERED=1
EXPOSE 4000
CMD vwsfriend --username=${VWSFRIEND_USERNAME} --password=${VWSFRIEND_PASSWORD} --weconnect-username=${WECONNECT_USER} --weconnect-password=${WECONNECT_PASSWORD} --weconnect-spin=${WECONNECT_SPIN} --interval=${WECONNECT_INTERVAL} --port=${VWSFRIEND_PORT} --database-url=${DATABASE_URL} --config-dir=/config ${ADDITIONAL_PARAMETERS}