-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDockerfile.template
74 lines (65 loc) · 2.36 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
73
74
#
# Dockerfile template for balenaCloud/openBalena using name substitution
#
# This file will be used instead of any default Dockerfile when using
# openBalena or balenaCloud.
#
# balena templates reference:
# https://www.balena.io/docs/learn/develop/dockerfile/#dockerfile-templates
#
# Copyright (c) 2018 René-Marc Simard
# SPDX-License-Identifier: Apache-2.0
#
# Declare pre-build variables
ARG DEVICE_NAME=%%BALENA_MACHINE_NAME%%
# Define base image
FROM balenalib/${DEVICE_NAME}-alpine-python:2
# Declare build variables
ARG AIRTHINGSWAVE_VERSION=0.2
ARG VERSION=0.2.4
# Label image with metadata
LABEL maintainer="René-Marc Simard @renemarc" \
org.opencontainers.image.authors="René-Marc Simard @renemarc" \
org.opencontainers.image.description="Airthings Wave radon detector bridge for single-board computers" \
org.opencontainers.image.documentation="https://github.com/renemarc/balena-airthingswave" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.source="git@github.com:renemarc/balena-airthingswave" \
org.opencontainers.image.title="balena AirthingsWave" \
org.opencontainers.image.url="https://airthings.com/wave/" \
org.opencontainers.image.vendor="René-Marc Simard" \
org.opencontainers.image.version="${VERSION}" \
org.label-schema.usage="/usr/src/app/README.md" \
org.label-schema.schema-version="1.0"
# Setup application directory
WORKDIR /usr/src/app
# Install requirements
RUN apk add \
bluez \
g++ \
glib-dev \
linux-headers \
make \
py-setuptools \
&& pip install --no-cache-dir \
airthingswave-mqtt==${AIRTHINGSWAVE_VERSION} \
PyYAML \
&& wget www.airthings.com/tech/find_wave.py \
&& find /usr/local \
\( -type d -a -name test -o -name tests \) \
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
-exec rm -rf '{}' + \
&& apk del \
g++ \
glib-dev \
linux-headers \
make \
py-setuptools
# Copy project files in their proper locations
ARG CRON_PERIOD=hourly
COPY ["docker/crontask.sh", "/etc/periodic/${CRON_PERIOD}/airthingswave-mqtt"]
COPY ["docker/docker-entrypoint.sh", "/usr/local/bin/"]
COPY ["docker/config.yaml", "docker/start.sh", "README.md", "./"]
ENTRYPOINT ["docker-entrypoint.sh"]
# Start the main loop
#CMD ["crond", "-f", "-d", "8"]
CMD ["/usr/src/app/start.sh"]