Spaces:
Running
Running
zach
commited on
Commit
·
ea08a90
1
Parent(s):
9f33991
Fix docker file
Browse files- Dockerfile +13 -6
Dockerfile
CHANGED
@@ -1,6 +1,19 @@
|
|
1 |
# Use the official lightweight Python 3.11 slim image as the base
|
2 |
FROM python:3.11-slim
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
# Install uv and required system dependencies
|
5 |
# - `apt-get update` fetches the latest package lists
|
6 |
# - `apt-get install -y --no-install-recommends curl libpq-dev gcc build-essential` installs:
|
@@ -16,12 +29,6 @@ RUN apt-get update && \
|
|
16 |
apt-get remove -y curl && \
|
17 |
apt-get clean && rm -rf /var/lib/apt/lists/*
|
18 |
|
19 |
-
# Add uv to the system PATH so it can be run globally
|
20 |
-
ENV PATH="/root/.local/bin:$PATH"
|
21 |
-
|
22 |
-
# Set the working directory in the container
|
23 |
-
WORKDIR /app
|
24 |
-
|
25 |
# Copy dependency files first (pyproject.toml & uv.lock) to leverage Docker’s build cache
|
26 |
# - Ensures that if only the application code changes, dependencies do not need to be reinstalled
|
27 |
COPY pyproject.toml uv.lock /app/
|
|
|
1 |
# Use the official lightweight Python 3.11 slim image as the base
|
2 |
FROM python:3.11-slim
|
3 |
|
4 |
+
# Set up a new user named "user" with user ID 1000
|
5 |
+
RUN useradd -m -u 1000 user
|
6 |
+
|
7 |
+
# Switch to the "user" user
|
8 |
+
USER user
|
9 |
+
|
10 |
+
# Set home to the user's home directory
|
11 |
+
ENV HOME=/home/user \
|
12 |
+
PATH=/root/.local/bin:/home/user/.local/bin:$PATH
|
13 |
+
|
14 |
+
# Set the working directory to the user's home directory
|
15 |
+
WORKDIR $HOME/app
|
16 |
+
|
17 |
# Install uv and required system dependencies
|
18 |
# - `apt-get update` fetches the latest package lists
|
19 |
# - `apt-get install -y --no-install-recommends curl libpq-dev gcc build-essential` installs:
|
|
|
29 |
apt-get remove -y curl && \
|
30 |
apt-get clean && rm -rf /var/lib/apt/lists/*
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
# Copy dependency files first (pyproject.toml & uv.lock) to leverage Docker’s build cache
|
33 |
# - Ensures that if only the application code changes, dependencies do not need to be reinstalled
|
34 |
COPY pyproject.toml uv.lock /app/
|