Microservie docker update
This commit is contained in:
@ -12,8 +12,8 @@ COPY requirements.txt .
|
|||||||
RUN pip install --no-cache-dir -r requirements.txt \
|
RUN pip install --no-cache-dir -r requirements.txt \
|
||||||
--timeout=100 || pip install --no-cache-dir -r requirements.txt
|
--timeout=100 || pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# Copy application code
|
# Copy application code - MUST include microservice.py
|
||||||
COPY . .
|
COPY microservice.py .
|
||||||
|
|
||||||
ENV FLASK_ENV=production
|
ENV FLASK_ENV=production
|
||||||
ENV FLASK_APP=microservice.py
|
ENV FLASK_APP=microservice.py
|
||||||
@ -22,4 +22,5 @@ ENV FLASK_RUN_PORT=5001
|
|||||||
|
|
||||||
EXPOSE 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"]
|
||||||
@ -63,12 +63,13 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "8088:5001"
|
- "8088:5001"
|
||||||
volumes:
|
volumes:
|
||||||
- ./Microservice:/app
|
- ./Project:/app
|
||||||
networks:
|
networks:
|
||||||
- vending-network
|
- vending-network
|
||||||
environment:
|
environment:
|
||||||
- MAIN_BACKEND_URL=https://iotbackend.rootxwire.com
|
- MAIN_BACKEND_URL=https://iotbackend.rootxwire.com
|
||||||
- FLASK_ENV=production
|
- FLASK_ENV=production
|
||||||
|
- PYTHONPATH=/app
|
||||||
restart: always
|
restart: always
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "python", "-c", "import requests; requests.get('http://localhost:5001/', timeout=5)"]
|
test: ["CMD", "python", "-c", "import requests; requests.get('http://localhost:5001/', timeout=5)"]
|
||||||
|
|||||||
Reference in New Issue
Block a user