amine_dubs
commited on
Commit
·
0ff15d1
1
Parent(s):
bd85617
Ensure Dockerfile uses python:3.12-slim and apt-get
Browse files- Dockerfile +4 -19
Dockerfile
CHANGED
@@ -1,8 +1,7 @@
|
|
1 |
-
# Use an official Python
|
2 |
-
FROM python:3.
|
3 |
|
4 |
# Set the working directory in the container
|
5 |
-
# All subsequent commands (COPY, RUN, CMD) use this path
|
6 |
WORKDIR /app
|
7 |
|
8 |
# Install system dependencies including Rust, build tools, pkg-config, cmake, and sentencepiece dev libs using apt-get
|
@@ -16,9 +15,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
16 |
# Clean up apt lists to reduce image size
|
17 |
&& rm -rf /var/lib/apt/lists/*
|
18 |
|
19 |
-
# Set PKG_CONFIG_PATH to help find sentencepiece.pc
|
20 |
-
ENV PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/share/pkgconfig
|
21 |
-
|
22 |
# Copy only the requirements file first to leverage Docker cache
|
23 |
COPY backend/requirements.txt /app/requirements.txt
|
24 |
|
@@ -27,26 +23,15 @@ RUN pip install --no-cache-dir --upgrade pip
|
|
27 |
RUN pip install --no-cache-dir -r requirements.txt
|
28 |
|
29 |
# Copy the rest of the application code into the container
|
30 |
-
# This includes the backend directory, templates, static files etc.
|
31 |
-
# Adjust the source paths based on your project structure relative to the Dockerfile location
|
32 |
COPY backend/ /app/backend
|
33 |
COPY templates/ /app/templates
|
34 |
COPY static/ /app/static
|
35 |
-
# We don't copy uploads dir, it will be created by the app if needed
|
36 |
|
37 |
# Create the necessary directories within the container that the app expects
|
38 |
-
# Although the app tries to create them, it's good practice for Dockerfile to ensure they exist
|
39 |
RUN mkdir -p /app/templates /app/static /app/uploads
|
40 |
|
41 |
-
# Make port 8000 available
|
42 |
-
# Hugging Face Spaces often map to this port from the outside world (port 7860 is also common)
|
43 |
EXPOSE 8000
|
44 |
|
45 |
-
#
|
46 |
-
# ENV NAME World
|
47 |
-
|
48 |
-
# Run main.py using uvicorn when the container launches
|
49 |
-
# The command needs to specify the location of the app module (backend.main:app)
|
50 |
-
# Host 0.0.0.0 makes it accessible from outside the container
|
51 |
-
# Add --reload flag for development if needed, but remove for production
|
52 |
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
|
1 |
+
# Use an official Python slim-buster runtime as a parent image
|
2 |
+
FROM python:3.12-slim
|
3 |
|
4 |
# Set the working directory in the container
|
|
|
5 |
WORKDIR /app
|
6 |
|
7 |
# Install system dependencies including Rust, build tools, pkg-config, cmake, and sentencepiece dev libs using apt-get
|
|
|
15 |
# Clean up apt lists to reduce image size
|
16 |
&& rm -rf /var/lib/apt/lists/*
|
17 |
|
|
|
|
|
|
|
18 |
# Copy only the requirements file first to leverage Docker cache
|
19 |
COPY backend/requirements.txt /app/requirements.txt
|
20 |
|
|
|
23 |
RUN pip install --no-cache-dir -r requirements.txt
|
24 |
|
25 |
# Copy the rest of the application code into the container
|
|
|
|
|
26 |
COPY backend/ /app/backend
|
27 |
COPY templates/ /app/templates
|
28 |
COPY static/ /app/static
|
|
|
29 |
|
30 |
# Create the necessary directories within the container that the app expects
|
|
|
31 |
RUN mkdir -p /app/templates /app/static /app/uploads
|
32 |
|
33 |
+
# Make port 8000 available
|
|
|
34 |
EXPOSE 8000
|
35 |
|
36 |
+
# Run main.py using uvicorn
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "8000"]
|