Skip to content

Commit 2ea4113

Browse files
committed
Initial commit
0 parents  commit 2ea4113

File tree

15 files changed

+1036
-0
lines changed

15 files changed

+1036
-0
lines changed

.dockerignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.*
2+
hooks
3+
manifest.sh
4+
*.md
5+
*.txt
6+
7+
!README.md

.github/README.md

Lines changed: 317 additions & 0 deletions
Large diffs are not rendered by default.

.github/build-pipeline.svg

Lines changed: 2 additions & 0 deletions
Loading

.github/logo.svg

Lines changed: 2 additions & 0 deletions
Loading

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.DS_Store
2+
.idea
3+
thumbs.db

.travis.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#
2+
# Travis-CI.org configuration file
3+
#
4+
# Orchestrates the Travis build of a Docker manifest for Docker Hub.
5+
# https://docs.travis-ci.com/user/docker/
6+
#
7+
8+
# Setup environment for Docker builds.
9+
language: minimal
10+
sudo: required
11+
12+
# Enable Docker experimental features, to be able to use the "manifest" command.
13+
addons:
14+
apt:
15+
packages:
16+
- docker-ce
17+
before_install:
18+
- mkdir -p ~/.docker
19+
- echo '{"experimental":"enabled"}' > ~/.docker/config.json
20+
- docker version
21+
22+
# Create and test Docker manifest.
23+
script:
24+
- ./manifest.sh -b
25+
- docker run --detach --privileged --restart=unless-stopped --net=host --cap-add=NET_ADMIN --name=flic renemarc/balena-flic:latest
26+
- sleep 5
27+
- docker logs flic
28+
29+
# Deploy manifest to Docker Hub.
30+
after_success:
31+
- echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin
32+
- ./manifest.sh -p

Dockerfile

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#
2+
# Dockerfile for ARM v6
3+
#
4+
# This file will be used on non balenaCloud/openBalena environments, like local
5+
# balenaEngine/Docker builds or Docker Hub.
6+
#
7+
# Based on the Home Assistant addon by @pschmitt:
8+
# https://github.com/pschmitt/hassio-addons/blob/master/flicd/Dockerfile
9+
#
10+
# Available base images:
11+
# https://www.balena.io/docs/reference/base-images/base-images/
12+
#
13+
14+
# Define base image
15+
FROM balenalib/rpi-alpine:latest
16+
17+
# Declare build environment variables
18+
ENV FLICLIB_ARCH armv6l
19+
ENV FLICLIB_VERSION 0.5
20+
ENV VERSION 0.5
21+
22+
# Define build arguments
23+
ARG BUILD_DATE
24+
ARG VCS_REF
25+
26+
# Label image with metadata
27+
LABEL org.label-schema.build-date=${BUILD_DATE} \
28+
org.label-schema.name="balena Flic" \
29+
org.label-schema.description="Flic smart button bridge for single-board computers." \
30+
org.label-schema.docker.cmd="docker run --detach --restart=unless-stopped --net=host --cap-add=NET_ADMIN --name=flic renemarc/balena-flic" \
31+
org.label-schema.docker.cmd.debug="docker run -it --net=host --cap-add=NET_ADMIN \$CONTAINER /bin/bash" \
32+
org.label-schema.docker.cmd.help="docker run -it --rm --net=host --cap-add=NET_ADMIN renemarc/balena-flic /usr/bin/flicd --help" \
33+
org.label-schema.vcs-ref=${VCS_REF} \
34+
org.label-schema.vcs-url="https://github.com/renemarc/balena-flic" \
35+
org.label-schema.url="https://flic.io/" \
36+
org.label-schema.version=${VERSION} \
37+
org.label-schema.schema-version="1.0"
38+
39+
# Start QEMU virtualization
40+
RUN ["cross-build-start"]
41+
42+
# Install requirements
43+
RUN apk add \
44+
g++ \
45+
git \
46+
libc6-compat \
47+
libstdc++ \
48+
make \
49+
&& git clone --branch ${FLICLIB_VERSION} --depth 1 \
50+
https://github.com/50ButtonsEach/fliclib-linux-hci /tmp/src \
51+
&& make --directory=/tmp/src/simpleclient \
52+
&& cp /tmp/src/simpleclient/simpleclient /usr/bin/ \
53+
&& cp /tmp/src/bin/${FLICLIB_ARCH}/flicd /usr/bin/ \
54+
&& chmod +x /usr/bin/flicd \
55+
&& apk del \
56+
g++ \
57+
git \
58+
make \
59+
&& rm -rf \
60+
/tmp/src
61+
62+
# Setup application directory
63+
WORKDIR /data
64+
65+
# Create a volume to store the database
66+
VOLUME ["/data"]
67+
68+
# Listen to Flic service TCP port
69+
EXPOSE 5551
70+
71+
# Start Flic daemon
72+
CMD [ "/usr/bin/flicd", \
73+
"--db-file", "/data/flic.sqlite", \
74+
"--server-addr", "0.0.0.0", \
75+
"--server-port", "5551" \
76+
]
77+
78+
# Complete QEMU virtualization
79+
RUN ["cross-build-end"]

Dockerfile-debian.Dockerfile

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#
2+
# Dockerfile for x86
3+
#
4+
# This file will be used on non balenaCloud/openBalena environments, like local
5+
# balenaEngine/Docker builds or Docker Hub.
6+
#
7+
# Based on the Home Assistant addon by @pschmitt:
8+
# https://github.com/pschmitt/hassio-addons/blob/master/flicd/Dockerfile
9+
#
10+
# Available base images:
11+
# https://www.balena.io/docs/reference/base-images/base-images/
12+
#
13+
14+
# Define base image
15+
FROM balenalib/amd64-debian:stretch
16+
17+
# Declare build environment variables
18+
ENV FLICLIB_ARCH x86_64
19+
ENV FLICLIB_VERSION 0.5
20+
ENV VERSION 0.5
21+
22+
# Define build arguments
23+
ARG BUILD_DATE
24+
ARG VCS_REF
25+
26+
# Label image with metadata
27+
LABEL org.label-schema.build-date=${BUILD_DATE} \
28+
org.label-schema.name="balena Flic" \
29+
org.label-schema.description="Flic smart button bridge for single-board computers." \
30+
org.label-schema.docker.cmd="docker run --detach --restart=unless-stopped --net=host --cap-add=NET_ADMIN --name=flic renemarc/balena-flic" \
31+
org.label-schema.docker.cmd.debug="docker run -it --net=host --cap-add=NET_ADMIN \$CONTAINER /bin/bash" \
32+
org.label-schema.docker.cmd.help="docker run -it --rm --net=host --cap-add=NET_ADMIN renemarc/balena-flic /usr/bin/flicd --help" \
33+
org.label-schema.vcs-ref=${VCS_REF} \
34+
org.label-schema.vcs-url="https://github.com/renemarc/balena-flic" \
35+
org.label-schema.url="https://flic.io/" \
36+
org.label-schema.version=${VERSION} \
37+
org.label-schema.schema-version="1.0"
38+
39+
# Install requirements
40+
RUN apt-get update \
41+
&& apt-get install --yes --quiet \
42+
g++ \
43+
git \
44+
make \
45+
&& git clone --branch ${FLICLIB_VERSION} --depth 1 \
46+
https://github.com/50ButtonsEach/fliclib-linux-hci /tmp/src \
47+
&& make --directory=/tmp/src/simpleclient \
48+
&& cp /tmp/src/simpleclient/simpleclient /usr/bin/ \
49+
&& cp /tmp/src/bin/${FLICLIB_ARCH}/flicd /usr/bin/ \
50+
&& chmod +x /usr/bin/flicd \
51+
&& apt-get remove --purge \
52+
g++ \
53+
git \
54+
make \
55+
&& apt-get clean \
56+
&& rm -rf \
57+
/var/lib/apt/** \
58+
/tmp/src
59+
60+
# Setup application directory
61+
WORKDIR /data
62+
63+
# Create a volume to store the database
64+
VOLUME ["/data"]
65+
66+
# Listen to Flic service TCP port
67+
EXPOSE 5551
68+
69+
# Start Flic daemon
70+
CMD [ "/usr/bin/flicd", \
71+
"--db-file", "/data/flic.sqlite", \
72+
"--server-addr", "0.0.0.0", \
73+
"--server-port", "5551" \
74+
]

Dockerfile.template

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#
2+
# Dockerfile template for balenaCloud/openBalena using name substitution
3+
#
4+
# This file will be used instead of any default Dockerfile when using
5+
# openBalena or balenaCloud.
6+
#
7+
# @link https://www.balena.io/docs/learn/develop/dockerfile/#dockerfile-templates
8+
#
9+
# Based on the Home Assistant addon by @pschmitt:
10+
# https://github.com/pschmitt/hassio-addons/blob/master/flicd/Dockerfile
11+
#
12+
13+
# Define base image (target either %%BALENA_ARCH%% or %%BALENA_MACHINE_NAME%%)
14+
FROM balena/%%BALENA_ARCH%%-alpine:latest
15+
16+
# Declare build environment variables
17+
ENV FLICLIB_ARCH unknown
18+
ENV FLICLIB_VERSION 0.5
19+
ENV VERSION 0.5
20+
21+
# Label image with metadata
22+
LABEL org.label-schema.name="balena Flic" \
23+
org.label-schema.description="Flic smart button bridge for single-board computers." \
24+
org.label-schema.docker.cmd="docker run --detach --restart=unless-stopped --net=host --cap-add=NET_ADMIN --name=flic renemarc/balena-flic" \
25+
org.label-schema.docker.cmd.debug="docker run -it --net=host --cap-add=NET_ADMIN \$CONTAINER /bin/bash" \
26+
org.label-schema.docker.cmd.help="docker run -it --rm --net=host --cap-add=NET_ADMIN renemarc/balena-flic /usr/bin/flicd --help" \
27+
org.label-schema.vcs-url="https://github.com/renemarc/balena-flic" \
28+
org.label-schema.url="https://flic.io/" \
29+
org.label-schema.version=${VERSION} \
30+
org.label-schema.schema-version="1.0"
31+
32+
# Install requirements
33+
RUN case %%BALENA_ARCH%% in \
34+
amd64) export FLICLIB_ARCH=x86_64 ;; \
35+
i386) export FLICLIB_ARCH=i386 ;; \
36+
rpi|armv7hf|aarch64) export FLICLIB_ARCH=armv6l ;; \
37+
esac \
38+
&& apk add \
39+
g++ \
40+
git \
41+
libc6-compat \
42+
libstdc++ \
43+
make \
44+
&& git clone --branch ${FLICLIB_VERSION} --depth 1 \
45+
https://github.com/50ButtonsEach/fliclib-linux-hci /tmp/src \
46+
&& make --directory=/tmp/src/simpleclient \
47+
&& cp /tmp/src/simpleclient/simpleclient /usr/bin/ \
48+
&& cp /tmp/src/bin/${FLICLIB_ARCH}/flicd /usr/bin/ \
49+
&& chmod +x /usr/bin/flicd \
50+
&& apk del \
51+
g++ \
52+
git \
53+
make \
54+
&& rm -rf \
55+
/tmp/src
56+
57+
# Setup application directory
58+
WORKDIR /data
59+
60+
# Create a volume to store the database
61+
VOLUME ["/data"]
62+
63+
# Listen to Flic service TCP port
64+
EXPOSE 5551
65+
66+
# Start Flic daemon
67+
ENTRYPOINT ["/usr/bin/flicd"]
68+
CMD [ "--db-file", "/data/flic.sqlite", \
69+
"--server-addr", "0.0.0.0", \
70+
"--server-port", "5551" \
71+
]

0 commit comments

Comments
 (0)