-
Notifications
You must be signed in to change notification settings - Fork 1
/
Containerfile
39 lines (32 loc) · 1.15 KB
/
Containerfile
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
FROM python:3-alpine
LABEL maintainer='Richard Arends'
ENV USERNAME='[email protected]'
ENV PASSWORD='secret'
ENV VIN='your vin'
ENV POLL_INTERVAL=60
ENV DEBUG=False
ENV INFLUX_SERVER='influx.example.com'
ENV WRITE_TO_INFLUX=True
ENV MONGO_SERVER='mongo.example.com'
ENV MONGO_DATABASE='tesla'
ENV WRITE_TO_MONGO=True
ENV MQTT_SERVER='mqtt.example.com'
ENV MQTT_USERNAME='mqtt'
ENV MQTT_PASSWORD='secret'
ENV PUBLISH_ON_MQTT=True
RUN apk add --update supervisor && \
rm -rf /tmp/* /var/cache/apk/* && \
adduser -D apprunner && \
mkdir -p /usr/local/tesladata
COPY requirements.txt /usr/local/tesladata/
COPY src/* /usr/local/tesladata/
COPY src/container/config.sh /usr/local/tesladata/
COPY src/container/supervisord.conf /etc/
RUN pip install --no-cache-dir -r /usr/local/tesladata/requirements.txt && \
chmod 755 /usr/local/tesladata/config.sh && \
install -o apprunner -g apprunner -m 0640 /dev/null /usr/local/tesladata/config.yaml
WORKDIR /home/apprunner
USER apprunner
RUN mkdir /home/apprunner/cron && \
echo '*/1 * * * * /usr/local/bin/python3 -u /usr/local/tesladata/mongo-to-influxdb.py' > /home/apprunner/cron/apprunner
CMD [ "/usr/bin/supervisord" ]