Update Dockerfile
Browse files- Dockerfile +4 -3
Dockerfile
CHANGED
@@ -31,6 +31,7 @@ RUN apt-get update && \
|
|
31 |
|
32 |
RUN mkdir -p /usr/local/share/fonts/truetype/mycustomfonts
|
33 |
COPY assets/fonts/arial.ttf /usr/local/share/fonts/truetype/mycustomfonts/arial.ttf
|
|
|
34 |
RUN fc-cache -f -s -v
|
35 |
|
36 |
ARG APP_USER_UID=1000
|
@@ -38,7 +39,8 @@ ARG APP_USER_GID=1000
|
|
38 |
RUN groupadd --gid $APP_USER_GID appgroup && \
|
39 |
useradd --uid $APP_USER_UID --gid appgroup --shell /bin/bash --create-home appuser
|
40 |
|
41 |
-
|
|
|
42 |
|
43 |
# Copy requirements first (as root or default builder user)
|
44 |
COPY requirements.txt ./
|
@@ -49,14 +51,13 @@ RUN python -m pip install --no-cache-dir --upgrade pip && \
|
|
49 |
COPY . .
|
50 |
|
51 |
# Ensure the output directory exists and is writable by appuser BEFORE switching user
|
52 |
-
# Create it as root, then chown specifically, then chown the whole app dir.
|
53 |
RUN mkdir -p /home/appuser/app/temp_cinegen_media && \
|
54 |
chown -R appuser:appgroup /home/appuser/app/temp_cinegen_media && \
|
55 |
chown -R appuser:appgroup /home/appuser/app
|
56 |
-
# chmod -R 775 /home/appuser/app/temp_cinegen_media # Optionally, more explicit permissions
|
57 |
|
58 |
# Switch to the non-root user
|
59 |
USER appuser
|
|
|
60 |
ENV PATH="/home/appuser/.local/bin:${PATH}"
|
61 |
|
62 |
EXPOSE 8501
|
|
|
31 |
|
32 |
RUN mkdir -p /usr/local/share/fonts/truetype/mycustomfonts
|
33 |
COPY assets/fonts/arial.ttf /usr/local/share/fonts/truetype/mycustomfonts/arial.ttf
|
34 |
+
|
35 |
RUN fc-cache -f -s -v
|
36 |
|
37 |
ARG APP_USER_UID=1000
|
|
|
39 |
RUN groupadd --gid $APP_USER_GID appgroup && \
|
40 |
useradd --uid $APP_USER_UID --gid appgroup --shell /bin/bash --create-home appuser
|
41 |
|
42 |
+
# Set WORKDIR for appuser's home/app space
|
43 |
+
WORKDIR /home/appuser/app
|
44 |
|
45 |
# Copy requirements first (as root or default builder user)
|
46 |
COPY requirements.txt ./
|
|
|
51 |
COPY . .
|
52 |
|
53 |
# Ensure the output directory exists and is writable by appuser BEFORE switching user
|
|
|
54 |
RUN mkdir -p /home/appuser/app/temp_cinegen_media && \
|
55 |
chown -R appuser:appgroup /home/appuser/app/temp_cinegen_media && \
|
56 |
chown -R appuser:appgroup /home/appuser/app
|
|
|
57 |
|
58 |
# Switch to the non-root user
|
59 |
USER appuser
|
60 |
+
# Ensure user's local bin is in PATH for pip-installed executables
|
61 |
ENV PATH="/home/appuser/.local/bin:${PATH}"
|
62 |
|
63 |
EXPOSE 8501
|