switched to network mode host + changed init + compose
This commit is contained in:
@@ -9,7 +9,7 @@ ENV PYTHONDONTWRITEBYTECODE=1
|
|||||||
# Turns off buffering for easier container logging
|
# Turns off buffering for easier container logging
|
||||||
ENV PYTHONUNBUFFERED=1
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y iputils-ping
|
#RUN apt-get update && apt-get install -y iputils-ping
|
||||||
|
|
||||||
# Install pip requirements
|
# Install pip requirements
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
@@ -24,4 +24,4 @@ RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /
|
|||||||
USER appuser
|
USER appuser
|
||||||
|
|
||||||
# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
|
# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
|
||||||
CMD ["gunicorn", "--bind", "0.0.0.0:5200", "web2mqtt.webapp:app"]
|
CMD ["gunicorn", "--bind", "0.0.0.0:5200", "--timeout", "60", "--workers", "2", "web2mqtt.webapp:app"]
|
||||||
|
|||||||
@@ -7,5 +7,4 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: ./Dockerfile
|
dockerfile: ./Dockerfile
|
||||||
ports:
|
network_mode: host
|
||||||
- 5200:5200
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ from flask import Flask # Import the Flask class
|
|||||||
app = Flask(__name__) # Create an instance of the class for our use
|
app = Flask(__name__) # Create an instance of the class for our use
|
||||||
|
|
||||||
import paho.mqtt.client as mqtt
|
import paho.mqtt.client as mqtt
|
||||||
|
print("Starting up...")
|
||||||
client = mqtt.Client("Web2Mqtt")
|
client = mqtt.Client("Web2Mqtt")
|
||||||
client.connect("192.168.178.36",1884,keepalive=60)
|
client.connect("192.168.178.36",1884,keepalive=60)
|
||||||
client.publish("web2mqtt/status","Web2Mqtt starting up...")
|
client.publish("web2mqtt/status","Web2Mqtt starting up...")
|
||||||
Reference in New Issue
Block a user