Update Dockerfile
Browse files- Dockerfile +4 -5
Dockerfile
CHANGED
|
@@ -4,12 +4,14 @@ FROM python:3.10.9
|
|
| 4 |
RUN addgroup --gid 1001 appgroup && adduser --uid 1001 --gid 1001 --disabled-password --gecos "" appuser
|
| 5 |
|
| 6 |
# Create directories with appropriate permissions and change ownership
|
| 7 |
-
RUN mkdir -m 777 /tmp/NUMBA_CACHE_DIR /tmp/MPLCONFIGDIR
|
| 8 |
-
RUN chown -R appuser:appgroup /tmp/NUMBA_CACHE_DIR /tmp/MPLCONFIGDIR
|
| 9 |
|
| 10 |
# Set environment variables
|
| 11 |
ENV NUMBA_CACHE_DIR=/tmp/NUMBA_CACHE_DIR/
|
| 12 |
ENV MPLCONFIGDIR=/tmp/MPLCONFIGDIR/
|
|
|
|
|
|
|
| 13 |
|
| 14 |
# Copy all files to the container
|
| 15 |
COPY . .
|
|
@@ -30,8 +32,5 @@ USER appuser
|
|
| 30 |
RUN /opt/venv/bin/pip install --no-cache-dir --upgrade pip && \
|
| 31 |
/opt/venv/bin/pip install --no-cache-dir --upgrade -r /requirements.txt
|
| 32 |
|
| 33 |
-
# Ensure the virtual environment is activated for subsequent commands
|
| 34 |
-
ENV PATH="/opt/venv/bin:$PATH"
|
| 35 |
-
|
| 36 |
# Command to run the application
|
| 37 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 4 |
RUN addgroup --gid 1001 appgroup && adduser --uid 1001 --gid 1001 --disabled-password --gecos "" appuser
|
| 5 |
|
| 6 |
# Create directories with appropriate permissions and change ownership
|
| 7 |
+
RUN mkdir -m 777 /tmp/NUMBA_CACHE_DIR /tmp/MPLCONFIGDIR /home/appuser/.local
|
| 8 |
+
RUN chown -R appuser:appgroup /tmp/NUMBA_CACHE_DIR /tmp/MPLCONFIGDIR /home/appuser/.local
|
| 9 |
|
| 10 |
# Set environment variables
|
| 11 |
ENV NUMBA_CACHE_DIR=/tmp/NUMBA_CACHE_DIR/
|
| 12 |
ENV MPLCONFIGDIR=/tmp/MPLCONFIGDIR/
|
| 13 |
+
ENV HOME=/home/appuser
|
| 14 |
+
ENV PATH="/opt/venv/bin:$PATH"
|
| 15 |
|
| 16 |
# Copy all files to the container
|
| 17 |
COPY . .
|
|
|
|
| 32 |
RUN /opt/venv/bin/pip install --no-cache-dir --upgrade pip && \
|
| 33 |
/opt/venv/bin/pip install --no-cache-dir --upgrade -r /requirements.txt
|
| 34 |
|
|
|
|
|
|
|
|
|
|
| 35 |
# Command to run the application
|
| 36 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|