Skip to content

Commit

Permalink
Bettering Docker part
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose committed Sep 13, 2018
1 parent 2485bd4 commit 363af73
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.github/*
.gitignore
.travis.yml
CHANGELOG.md
logo.gif
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM python:3.6-slim-stretch

LABEL maintainer="labs@idealista.com"

EXPOSE 8089

RUN apt-get update && apt-get install -y build-essential

ADD LICENSE /opt/prom2teams/LICENSE
ADD MANIFEST.in /opt/prom2teams/MANIFEST.in
ADD README.md /opt/prom2teams/README.md
ADD requirements.txt /opt/prom2teams/requirements.txt
ADD setup.py /opt/prom2teams/setup.py

ADD ./bin /opt/prom2teams/bin
ADD ./prom2teams /opt/prom2teams/prom2teams

ADD ./dockerhub/config.ini /opt/prom2teams/config.ini
ADD ./dockerhub/replace_config.py /opt/prom2teams/replace_config.py
ADD ./dockerhub/prom2teams_start.sh /opt/prom2teams/prom2teams_start.sh

WORKDIR /opt/prom2teams
RUN python setup.py install

ENV PROM2TEAMS_PORT="8089"
ENV PROM2TEAMS_HOST="0.0.0.0"
ENV PROM2TEAMS_LOGLEVEL="INFO"
ENV PROM2TEAMS_CONNECTOR=""
ENV PROM2TEAMS_GROUP_ALERTS_BY=""

ENTRYPOINT ["bash", "/opt/prom2teams/prom2teams_start.sh"]
3 changes: 3 additions & 0 deletions dockerhub/config.ini → docker/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ Port: prom2teamsport

[Microsoft Teams]
Connector: prom2teamsconnector

[Group Alerts]
Field: prom2teamsgroupalertsby
File renamed without changes.
1 change: 1 addition & 0 deletions dockerhub/replace_config.py → docker/replace_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
filedata = filedata.replace("prom2teamsport", os.environ.get("PROM2TEAMS_PORT"))
filedata = filedata.replace("prom2teamshost", os.environ.get("PROM2TEAMS_HOST"))
filedata = filedata.replace("prom2teamsconnector", os.environ.get("PROM2TEAMS_CONNECTOR"))
filedata = filedata.replace("prom2teamsgroupalertsby", os.environ.get("PROM2TEAMS_GROUP_ALERTS_BY"))

with open('/opt/prom2teams/config.ini', 'w') as file:
file.write(filedata)
18 changes: 0 additions & 18 deletions dockerhub/Dockerfile

This file was deleted.

0 comments on commit 363af73

Please sign in to comment.