Spaces:
Sleeping
Sleeping
Commit
·
b9c58c0
1
Parent(s):
1362320
Docker update to make dir and permissions
Browse files- Dockerfile +8 -0
- main.py +1 -1
Dockerfile
CHANGED
|
@@ -10,6 +10,14 @@ COPY requirements.txt /app
|
|
| 10 |
# Install any needed packages specified in requirements.txt
|
| 11 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
COPY . /app
|
| 14 |
|
| 15 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 10 |
# Install any needed packages specified in requirements.txt
|
| 11 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
|
| 13 |
+
# Create a non-root user
|
| 14 |
+
RUN useradd -m appuser
|
| 15 |
+
|
| 16 |
+
# Create necessary directories and set permissions
|
| 17 |
+
RUN mkdir -p /app/data && \
|
| 18 |
+
chown -R appuser:appuser /app && \
|
| 19 |
+
chmod -R 755 /app && \
|
| 20 |
+
|
| 21 |
COPY . /app
|
| 22 |
|
| 23 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
main.py
CHANGED
|
@@ -30,7 +30,7 @@ logger = logging.getLogger(__name__)
|
|
| 30 |
app = FastAPI()
|
| 31 |
|
| 32 |
# SQLite setup
|
| 33 |
-
DB_PATH = "data/conversations.db"
|
| 34 |
|
| 35 |
# In-memory storage for conversations
|
| 36 |
conversations: Dict[str, List[Dict[str, str]]] = {}
|
|
|
|
| 30 |
app = FastAPI()
|
| 31 |
|
| 32 |
# SQLite setup
|
| 33 |
+
DB_PATH = "app/data/conversations.db"
|
| 34 |
|
| 35 |
# In-memory storage for conversations
|
| 36 |
conversations: Dict[str, List[Dict[str, str]]] = {}
|