Spaces:
Sleeping
Sleeping
Jon Taylor
commited on
Commit
·
2f845aa
1
Parent(s):
2a610e2
added user 1000
Browse files- Dockerfile +14 -3
Dockerfile
CHANGED
|
@@ -27,6 +27,17 @@ RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg -
|
|
| 27 |
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list > /dev/null
|
| 28 |
RUN apt-get update && apt-get install nodejs -y
|
| 29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
# Install Python dependencies
|
| 31 |
COPY ./requirements.txt /code/requirements.txt
|
| 32 |
RUN pip3 install --no-cache-dir --upgrade -r /code/requirements.txt
|
|
@@ -36,12 +47,12 @@ COPY frontend/package*.json frontend/
|
|
| 36 |
RUN cd frontend && npm install
|
| 37 |
|
| 38 |
# Copy frontend app and build
|
| 39 |
-
COPY frontend/ frontend/
|
| 40 |
RUN cd frontend && npm run build
|
| 41 |
|
| 42 |
# Copy everything else
|
| 43 |
-
COPY app/ app/
|
| 44 |
-
COPY server.py server.py
|
| 45 |
|
| 46 |
#ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libtcmalloc.so.4
|
| 47 |
CMD ["python3", "server.py"]
|
|
|
|
| 27 |
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list > /dev/null
|
| 28 |
RUN apt-get update && apt-get install nodejs -y
|
| 29 |
|
| 30 |
+
# Set up a new user named "user" with user ID 1000
|
| 31 |
+
RUN useradd -m -u 1000 user
|
| 32 |
+
# Switch to the "user" user
|
| 33 |
+
USER user
|
| 34 |
+
# Set home to the user's home directory
|
| 35 |
+
ENV HOME=/home/user \
|
| 36 |
+
PATH=/home/user/.local/bin:$PATH \
|
| 37 |
+
PYTHONPATH=$HOME/app \
|
| 38 |
+
PYTHONUNBUFFERED=1 \
|
| 39 |
+
SYSTEM=spaces
|
| 40 |
+
|
| 41 |
# Install Python dependencies
|
| 42 |
COPY ./requirements.txt /code/requirements.txt
|
| 43 |
RUN pip3 install --no-cache-dir --upgrade -r /code/requirements.txt
|
|
|
|
| 47 |
RUN cd frontend && npm install
|
| 48 |
|
| 49 |
# Copy frontend app and build
|
| 50 |
+
COPY --chown=user frontend/ frontend/
|
| 51 |
RUN cd frontend && npm run build
|
| 52 |
|
| 53 |
# Copy everything else
|
| 54 |
+
COPY --chown=user app/ app/
|
| 55 |
+
COPY --chown=user server.py server.py
|
| 56 |
|
| 57 |
#ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libtcmalloc.so.4
|
| 58 |
CMD ["python3", "server.py"]
|