-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile-debian
81 lines (72 loc) · 2.49 KB
/
Dockerfile-debian
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
#
# Debian Dockerfile
#
# This file will be used on non balenaCloud/openBalena environments, like local
# balenaEngine/Docker builds or Docker Hub.
#
# Based on the Home Assistant addon by @pschmitt:
# https://github.com/pschmitt/hassio-addons/blob/master/flicd/Dockerfile
#
# Available base images:
# https://www.balena.io/docs/reference/base-images/base-images/
#
# Declare pre-build variables
ARG ARCH_NAME=amd64
# Define base image
FROM balenalib/${ARCH_NAME}-debian:stretch
# Declare build variables
ARG ARCH_NAME
ARG BUILD_DATE=1970-01-01T00:00:00Z
ARG FLICLIB_ARCH=unknown
ARG FLICLIB_VERSION=0.5
ARG VCS_REF=0000000
ARG VERSION=0.5.3
# Label image with metadata
LABEL org.label-schema.build-date=${BUILD_DATE} \
org.label-schema.description="Flic smart button bridge for single-board computers." \
org.label-schema.docker.cmd="docker run --detach --restart=unless-stopped --net=host --cap-add=NET_ADMIN --name=flic renemarc/balena-flic" \
org.label-schema.docker.cmd.debug="docker run -it --net=host --cap-add=NET_ADMIN flic bash" \
org.label-schema.docker.cmd.help="docker run -it --rm --net=host --cap-add=NET_ADMIN renemarc/balena-flic flicd --help" \
org.label-schema.name="balena Flic" \
org.label-schema.url="https://flic.io/" \
org.label-schema.vcs-ref=${VCS_REF} \
org.label-schema.vcs-url="https://github.com/renemarc/balena-flic" \
org.label-schema.version=${VERSION} \
org.label-schema.schema-version="1.0"
# Install requirements
RUN case ${ARCH_NAME} in \
aarch64|armv7hf|rpi) export FLICLIB_ARCH=armv6l ;; \
amd64) export FLICLIB_ARCH=x86_64 ;; \
i386) export FLICLIB_ARCH=i386 ;; \
esac \
&& apt-get update \
&& apt-get install --yes --quiet \
g++ \
git \
make \
&& git clone --branch ${FLICLIB_VERSION} --depth 1 \
https://github.com/50ButtonsEach/fliclib-linux-hci /tmp/src \
&& make --directory=/tmp/src/simpleclient \
&& cp /tmp/src/simpleclient/simpleclient /usr/bin/ \
&& cp /tmp/src/bin/${FLICLIB_ARCH}/flicd /usr/bin/ \
&& chmod +x /usr/bin/flicd \
&& apt-get remove --purge \
g++ \
git \
make \
&& apt-get clean \
&& rm -rf \
/var/lib/apt/** \
/tmp/src
# Setup application directory
WORKDIR /data
# Create a volume to store the database
VOLUME [ "/data" ]
# Listen to Flic service TCP port
EXPOSE 5551
# Start Flic daemon
CMD [ "/usr/bin/flicd", \
"--db-file", "/data/flic.sqlite", \
"--server-addr", "0.0.0.0", \
"--server-port", "5551" \
]