Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker improvements #73

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions Dockerfile.compose
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

FROM debian:stretch-slim

RUN apt-get -y update

# Install Python
RUN apt-get -y install python3
RUN apt-get -y install apt-transport-https
RUN apt-get -y install curl
RUN apt-get -y install gnupg2
RUN apt-get -y install git
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
python3 \
apt-transport-https \
curl \
gnupg2 \
git \
python3-pip \
&& rm -rf /var/lib/apt/lists/ /var/cache/apt/*

# Install Tesla API Scraper
RUN apt-get -y install python3-pip
WORKDIR /
RUN pip3 install influxdb

Expand All @@ -26,13 +26,11 @@ ARG gitversion
# Configure it
RUN git clone https://github.com/lephisto/tesla-apiscraper
WORKDIR tesla-apiscraper
RUN git pull
RUN git checkout $gitversion
RUN git pull && git checkout $gitversion

# Define our startup script
RUN echo "#!/bin/bash" > /start.sh
RUN echo "python3 /tesla-apiscraper/apiscraper.py" >> /start.sh
RUN chmod +x /start.sh
COPY entrypoint.sh /

# Run it
EXPOSE 8023
CMD /start.sh
ENTRYPOINT ["/entrypoint.sh"]
6 changes: 4 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version: '2'
services:

influxdb:
restart: unless-stopped
image: "influxdb:latest"
container_name: "influxdb_apiscraper"
environment:
Expand All @@ -12,6 +13,7 @@ services:
- /opt/apiscraper/influxdb:/var/lib/influxdb

grafana:
restart: unless-stopped
image: grafana/grafana:latest
container_name: "grafana_apiscraper"
environment:
Expand All @@ -28,6 +30,7 @@ services:
- ./provisioning/:/etc/grafana/provisioning

apiscraper:
restart: unless-stopped
container_name: apiscraper
build:
args:
Expand All @@ -38,7 +41,6 @@ services:
- ./config.py:/tesla-apiscraper/config.py
- ./apiscraper.log:/tesla-apiscraper/apiscraper.log
ports:
- "8023:8023"
restart: on-failure:5
- "8023"
depends_on:
- influxdb
3 changes: 3 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

python3 /tesla-apiscraper/apiscraper.py