diff --git a/Project/Dockerfile b/Project/Dockerfile index 1852f25..5b77a4a 100644 --- a/Project/Dockerfile +++ b/Project/Dockerfile @@ -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"] \ No newline at end of file +# Use python -m to run the module directly +CMD ["python", "-m", "gunicorn", "--bind", "0.0.0.0:5001", "--workers", "2", "--timeout", "120", "microservice:app"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 6dc0ec7..051d6b2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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)"]