-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile.template
72 lines (63 loc) · 1.95 KB
/
Dockerfile.template
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
#
# Dockerfile template for balenaCloud/openBalena using name substitution
#
# This file will be used instead of any default Dockerfile when using
# openBalena or balenaCloud.
#
# @link https://www.balena.io/docs/learn/develop/dockerfile/#dockerfile-templates
#
# Based on the Home Assistant addon by @pschmitt:
# https://github.com/pschmitt/hassio-addons/blob/master/flicd/Dockerfile
#
# Declare pre-build variables
ARG ARCH_NAME=%%BALENA_ARCH%%
# Define base image
FROM balenalib/${ARCH_NAME}-alpine:latest
# Declare build variables
ARG ARCH_NAME
ARG FLICLIB_ARCH=unknown
ARG FLICLIB_VERSION=0.5
ARG VERSION=0.5.3
# Label image with metadata
LABEL org.label-schema.description="Flic smart button bridge for single-board computers." \
org.label-schema.name="balena Flic" \
org.label-schema.url="https://flic.io/" \
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 \
&& apk add \
g++ \
git \
libc6-compat \
libstdc++ \
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 \
&& apk del \
g++ \
git \
make \
&& rm -rf \
/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" \
]