Commit
·
41e802f
1
Parent(s):
d382ddb
Fix Docker permission issues
Browse files- Switch to root user for package installation
- Use python3 explicitly instead of python
- Switch back to chrome user for security
- Should resolve apk permission denied errors
- Dockerfile +8 -2
Dockerfile
CHANGED
|
@@ -1,5 +1,8 @@
|
|
| 1 |
FROM zenika/alpine-chrome:with-playwright
|
| 2 |
|
|
|
|
|
|
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
# Install Python and pip
|
|
@@ -7,15 +10,18 @@ RUN apk add --no-cache python3 py3-pip
|
|
| 7 |
|
| 8 |
# Copy requirements first for better caching
|
| 9 |
COPY requirements.txt .
|
| 10 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 11 |
|
| 12 |
# Copy your code
|
| 13 |
COPY . .
|
| 14 |
|
|
|
|
|
|
|
|
|
|
| 15 |
# FastAPI and Uvicorn are already installed via requirements.txt
|
| 16 |
# Playwright browsers are already available in the base image
|
| 17 |
|
| 18 |
EXPOSE 7860
|
| 19 |
|
| 20 |
# Run the FastAPI application
|
| 21 |
-
CMD ["
|
|
|
|
| 1 |
FROM zenika/alpine-chrome:with-playwright
|
| 2 |
|
| 3 |
+
# Switch to root user to install packages
|
| 4 |
+
USER root
|
| 5 |
+
|
| 6 |
WORKDIR /app
|
| 7 |
|
| 8 |
# Install Python and pip
|
|
|
|
| 10 |
|
| 11 |
# Copy requirements first for better caching
|
| 12 |
COPY requirements.txt .
|
| 13 |
+
RUN python3 -m pip install --no-cache-dir -r requirements.txt
|
| 14 |
|
| 15 |
# Copy your code
|
| 16 |
COPY . .
|
| 17 |
|
| 18 |
+
# Switch back to chrome user for security
|
| 19 |
+
USER chrome
|
| 20 |
+
|
| 21 |
# FastAPI and Uvicorn are already installed via requirements.txt
|
| 22 |
# Playwright browsers are already available in the base image
|
| 23 |
|
| 24 |
EXPOSE 7860
|
| 25 |
|
| 26 |
# Run the FastAPI application
|
| 27 |
+
CMD ["python3", "-m", "uvicorn", "scrape:app", "--host", "0.0.0.0", "--port", "7860"]
|