amaye15 commited on
Commit
3ea8097
·
1 Parent(s): de65e47

Debug - Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +81 -1
Dockerfile CHANGED
@@ -1,3 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  # Stage 1: Build stage
2
  FROM python:3.11-slim as builder
3
 
@@ -6,10 +77,11 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
6
  PYTHONUNBUFFERED=1 \
7
  PATH="/root/.local/bin:$PATH"
8
 
9
- # Install system dependencies (curl and ca-certificates for uv installer)
10
  RUN apt-get update && apt-get install -y --no-install-recommends \
11
  curl \
12
  ca-certificates \
 
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
  # Install uv using the official installer
@@ -42,6 +114,11 @@ COPY --chown=user . /app
42
  # Stage 2: Runtime stage
43
  FROM python:3.11-slim
44
 
 
 
 
 
 
45
  # Create a non-root user
46
  RUN useradd -m -u 1000 user
47
  USER user
@@ -59,6 +136,9 @@ COPY --from=builder --chown=user /opt/venv /opt/venv
59
  # Copy only the necessary files from the builder stage
60
  COPY --from=builder --chown=user /app /app
61
 
 
 
 
62
  # Expose the port the app runs on
63
  EXPOSE 7860
64
 
 
1
+ # # Stage 1: Build stage
2
+ # FROM python:3.11-slim as builder
3
+
4
+ # # Set environment variables
5
+ # ENV PYTHONDONTWRITEBYTECODE=1 \
6
+ # PYTHONUNBUFFERED=1 \
7
+ # PATH="/root/.local/bin:$PATH"
8
+
9
+ # # Install system dependencies (curl and ca-certificates for uv installer)
10
+ # RUN apt-get update && apt-get install -y --no-install-recommends \
11
+ # curl \
12
+ # ca-certificates \
13
+ # && rm -rf /var/lib/apt/lists/*
14
+
15
+ # # Install uv using the official installer
16
+ # RUN curl -sSfL https://astral.sh/uv/install.sh | sh
17
+
18
+ # # Verify uv is installed and available
19
+ # RUN uv --version
20
+
21
+ # # Create a non-root user
22
+ # RUN useradd -m -u 1000 user
23
+
24
+ # # Set the working directory
25
+ # WORKDIR /app
26
+
27
+ # # Create a virtual environment
28
+ # RUN uv venv /opt/venv
29
+
30
+ # # Update PATH to include the virtual environment's bin directory
31
+ # ENV PATH="/opt/venv/bin:$PATH"
32
+
33
+ # # Copy only the requirements file first to leverage Docker cache
34
+ # COPY --chown=user ./requirements.txt /app/requirements.txt
35
+
36
+ # # Install dependencies into the virtual environment using uv
37
+ # RUN uv pip install --no-cache-dir -r requirements.txt
38
+
39
+ # # Copy the rest of the application code
40
+ # COPY --chown=user . /app
41
+
42
+ # # Stage 2: Runtime stage
43
+ # FROM python:3.11-slim
44
+
45
+ # # Create a non-root user
46
+ # RUN useradd -m -u 1000 user
47
+ # USER user
48
+
49
+ # # Set environment variables
50
+ # ENV PATH="/opt/venv/bin:$PATH" \
51
+ # PYTHONUNBUFFERED=1
52
+
53
+ # # Set the working directory
54
+ # WORKDIR /app
55
+
56
+ # # Copy the virtual environment from the builder stage
57
+ # COPY --from=builder --chown=user /opt/venv /opt/venv
58
+
59
+ # # Copy only the necessary files from the builder stage
60
+ # COPY --from=builder --chown=user /app /app
61
+
62
+ # # Expose the port the app runs on
63
+ # EXPOSE 7860
64
+
65
+ # # Health check to ensure the application is running
66
+ # HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
67
+ # CMD curl -f http://localhost:7860/health || exit 1
68
+
69
+ # # Command to run the application with hot reloading
70
+ # CMD ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "7860", "--reload"]
71
+
72
  # Stage 1: Build stage
73
  FROM python:3.11-slim as builder
74
 
 
77
  PYTHONUNBUFFERED=1 \
78
  PATH="/root/.local/bin:$PATH"
79
 
80
+ # Install system dependencies (curl, ca-certificates, and libgomp)
81
  RUN apt-get update && apt-get install -y --no-install-recommends \
82
  curl \
83
  ca-certificates \
84
+ libgomp1 \
85
  && rm -rf /var/lib/apt/lists/*
86
 
87
  # Install uv using the official installer
 
114
  # Stage 2: Runtime stage
115
  FROM python:3.11-slim
116
 
117
+ # Install libgomp in the runtime stage
118
+ RUN apt-get update && apt-get install -y --no-install-recommends \
119
+ libgomp1 \
120
+ && rm -rf /var/lib/apt/lists/*
121
+
122
  # Create a non-root user
123
  RUN useradd -m -u 1000 user
124
  USER user
 
136
  # Copy only the necessary files from the builder stage
137
  COPY --from=builder --chown=user /app /app
138
 
139
+ # Debugging step: Verify installed packages
140
+ RUN /opt/venv/bin/python -m pip list
141
+
142
  # Expose the port the app runs on
143
  EXPOSE 7860
144