Microservie docker update

This commit is contained in:
2025-10-21 10:30:23 +05:30
parent ef27c01e6b
commit 8710e52b3a
2 changed files with 6 additions and 4 deletions

View File

@ -12,8 +12,8 @@ COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt \
--timeout=100 || pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Copy application code - MUST include microservice.py
COPY microservice.py .
ENV FLASK_ENV=production
ENV FLASK_APP=microservice.py
@ -22,4 +22,5 @@ ENV FLASK_RUN_PORT=5001
EXPOSE 5001
CMD ["gunicorn", "--bind", "0.0.0.0:5001", "--workers", "2", "--timeout", "120", "microservice:app"]
# Use python -m to run the module directly
CMD ["python", "-m", "gunicorn", "--bind", "0.0.0.0:5001", "--workers", "2", "--timeout", "120", "microservice:app"]

View File

@ -63,12 +63,13 @@ services:
ports:
- "8088:5001"
volumes:
- ./Microservice:/app
- ./Project:/app
networks:
- vending-network
environment:
- MAIN_BACKEND_URL=https://iotbackend.rootxwire.com
- FLASK_ENV=production
- PYTHONPATH=/app
restart: always
healthcheck:
test: ["CMD", "python", "-c", "import requests; requests.get('http://localhost:5001/', timeout=5)"]