-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
62 lines (48 loc) · 1.83 KB
/
Dockerfile
File metadata and controls
62 lines (48 loc) · 1.83 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
# syntax=docker/dockerfile:1.4
# Stage 1: Download vcontrold for target architecture
FROM debian:bookworm-slim AS vcontrold-downloader
ARG TARGETARCH
ARG TARGETVARIANT
ARG VCONTROLD_VERSION=0.98.12
ARG VCONTROLD_DEB_REVISION=16
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
wget \
&& rm -rf /var/lib/apt/lists/*
RUN set -eux; \
case "${TARGETARCH}${TARGETVARIANT:+-${TARGETVARIANT}}" in \
"amd64") DEB_ARCH="amd64" ;; \
"arm64") DEB_ARCH="arm64" ;; \
"arm-v7") DEB_ARCH="armhf" ;; \
*) echo "Unsupported arch: ${TARGETARCH}${TARGETVARIANT:+-${TARGETVARIANT}}"; exit 1 ;; \
esac; \
wget -O /vcontrold.deb \
"https://github.com/openv/vcontrold/releases/download/v${VCONTROLD_VERSION}/vcontrold_${VCONTROLD_VERSION}-${VCONTROLD_DEB_REVISION}_${DEB_ARCH}.deb"
# Stage 2: Final image
FROM debian:bookworm-slim
# Copy vcontrold from downloader stage
COPY --from=vcontrold-downloader /vcontrold.deb /tmp/vcontrold.deb
# Install runtime dependencies and vcontrold
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
ca-certificates \
libxml2 \
&& dpkg -i /tmp/vcontrold.deb \
&& rm /tmp/vcontrold.deb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Create non-root user
RUN groupadd -r vcontrold \
&& useradd --no-log-init -r -g vcontrold -G dialout vcontrold \
&& mkdir -p /config \
&& chown -R vcontrold:vcontrold /config
# Copy the pre-built Rust binary from build context
COPY vcontrold-mqttd /usr/local/bin/vcontrold-mqttd
USER vcontrold
VOLUME ["/config"]
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=5s --start-period=40s --retries=3 \
CMD ["/usr/local/bin/vcontrold-mqttd", "--healthcheck"]
ENTRYPOINT ["/usr/local/bin/vcontrold-mqttd"]