forked from QuantumEntangledAndy/neolink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
93 lines (82 loc) · 2.68 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
80
81
82
83
84
85
86
87
88
89
90
91
92
# Neolink Docker image build scripts
# Copyright (c) 2020 George Hilliard,
# Andrew King,
# Miroslav Šedivý
# SPDX-License-Identifier: AGPL-3.0-only
FROM docker.io/rust:slim-bookworm AS build
ARG TARGETPLATFORM
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /usr/local/src/neolink
COPY . /usr/local/src/neolink
# Build the main program or copy from artifact
#
# We prefer copying from artifact to reduce
# build time on the github runners
#
# Because of this though, during normal
# github runner ops we are not testing the
# docker to see if it will build from scratch
# so if it is failing please make a PR
#
# hadolint ignore=DL3008
RUN echo "TARGETPLATFORM: ${TARGETPLATFORM}"; \
if [ -f "${TARGETPLATFORM}/neolink" ]; then \
echo "Restoring from artifact"; \
mkdir -p /usr/local/src/neolink/target/release/; \
cp "${TARGETPLATFORM}/neolink" "/usr/local/src/neolink/target/release/neolink"; \
else \
echo "Building from scratch"; \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
build-essential \
openssl \
libssl-dev \
ca-certificates \
libgstrtspserver-1.0-dev \
libgstreamer1.0-dev \
libgtk2.0-dev \
protobuf-compiler \
libglib2.0-dev && \
apt-get clean -y && rm -rf /var/lib/apt/lists/* ; \
cargo build --release; \
fi
# Create the release container. Match the base OS used to build
FROM debian:bookworm-slim
ARG TARGETPLATFORM
ARG REPO
ARG VERSION
ARG OWNER
LABEL description="An image for the neolink program which is a reolink camera to rtsp translator"
LABEL repository="$REPO"
LABEL version="$VERSION"
LABEL maintainer="$OWNER"
# hadolint ignore=DL3008
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
openssl \
dnsutils \
iputils-ping \
ca-certificates \
libgstrtspserver-1.0-0 \
libgstreamer1.0-0 \
gstreamer1.0-tools \
gstreamer1.0-x \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad \
gstreamer1.0-libav && \
apt-get clean -y && rm -rf /var/lib/apt/lists/*
COPY --from=build \
/usr/local/src/neolink/target/release/neolink \
/usr/local/bin/neolink
COPY docker/entrypoint.sh /entrypoint.sh
RUN gst-inspect-1.0; \
chmod +x "/usr/local/bin/neolink" && \
"/usr/local/bin/neolink" --version && \
mkdir -m 0700 /root/.config/
ENV NEO_LINK_MODE="rtsp" NEO_LINK_PORT=8554
CMD /usr/local/bin/neolink "${NEO_LINK_MODE}" --config /etc/neolink.toml
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE ${NEO_LINK_PORT}