Spaces:
Runtime error
Runtime error
Fix health check - use python urllib instead of curl
Browse files- Dockerfile +7 -3
Dockerfile
CHANGED
|
@@ -70,11 +70,15 @@ EXPOSE 8000
|
|
| 70 |
|
| 71 |
# Create a non-root user for security (the playwright image already has pwuser)
|
| 72 |
RUN chown -R pwuser:pwuser /app
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
USER pwuser
|
| 74 |
|
| 75 |
-
# Health check
|
| 76 |
-
HEALTHCHECK --interval=30s --timeout=30s --start-period=
|
| 77 |
-
CMD
|
| 78 |
|
| 79 |
# Run the application using entrypoint
|
| 80 |
ENTRYPOINT ["/entrypoint.sh"]
|
|
|
|
| 70 |
|
| 71 |
# Create a non-root user for security (the playwright image already has pwuser)
|
| 72 |
RUN chown -R pwuser:pwuser /app
|
| 73 |
+
|
| 74 |
+
# Install curl for health check before switching to non-root user
|
| 75 |
+
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
|
| 76 |
+
|
| 77 |
USER pwuser
|
| 78 |
|
| 79 |
+
# Health check - use wget instead of curl (more reliable in containers)
|
| 80 |
+
HEALTHCHECK --interval=30s --timeout=30s --start-period=60s --retries=3 \
|
| 81 |
+
CMD python3 -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/')" || exit 1
|
| 82 |
|
| 83 |
# Run the application using entrypoint
|
| 84 |
ENTRYPOINT ["/entrypoint.sh"]
|