zach commited on
Commit
28d668c
·
1 Parent(s): 5fae21a

Fix Dockerfile: add gcc, build-essential, and libpq-dev to resolve psycopg2 build errors during uv sync step

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -4
Dockerfile CHANGED
@@ -1,13 +1,17 @@
1
  # Use the official lightweight Python 3.11 slim image as the base
2
  FROM python:3.11-slim
3
 
4
- # Install uv using its standalone installer
5
  # - `apt-get update` fetches the latest package lists
6
- # - `apt-get install -y --no-install-recommends curl` installs curl to fetch the uv installer
 
 
 
7
  # - `curl -LsSf` downloads and runs the uv installer script
8
  # - `apt-get remove -y curl` removes curl after installation to save space
9
  # - `apt-get clean && rm -rf /var/lib/apt/lists/*` removes cached package lists to reduce image size
10
- RUN apt-get update && apt-get install -y --no-install-recommends curl && \
 
11
  curl -LsSf https://astral.sh/uv/install.sh | sh && \
12
  apt-get remove -y curl && \
13
  apt-get clean && rm -rf /var/lib/apt/lists/*
@@ -38,4 +42,4 @@ EXPOSE 7860
38
  # Define the command to start the application
39
  # - `uv run` ensures that the virtual environment is activated and dependencies are up to date
40
  # - `python -m src.app` runs the main application module
41
- CMD ["uv", "run", "python", "-m", "src.app"]
 
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:
7
+ # - curl: to fetch the uv installer script
8
+ # - libpq-dev: provides pg_config required by psycopg2
9
+ # - gcc & build-essential: required for compiling C extensions (e.g. psycopg2)
10
  # - `curl -LsSf` downloads and runs the uv installer script
11
  # - `apt-get remove -y curl` removes curl after installation to save space
12
  # - `apt-get clean && rm -rf /var/lib/apt/lists/*` removes cached package lists to reduce image size
13
+ RUN apt-get update && \
14
+ apt-get install -y --no-install-recommends curl libpq-dev gcc build-essential && \
15
  curl -LsSf https://astral.sh/uv/install.sh | sh && \
16
  apt-get remove -y curl && \
17
  apt-get clean && rm -rf /var/lib/apt/lists/*
 
42
  # Define the command to start the application
43
  # - `uv run` ensures that the virtual environment is activated and dependencies are up to date
44
  # - `python -m src.app` runs the main application module
45
+ CMD ["uv", "run", "python", "-m", "src.app"]