-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdockerfile.api
56 lines (45 loc) · 1.47 KB
/
dockerfile.api
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Use Ubuntu 22.04 as the base image
FROM ubuntu:22.04
# Set environment variables for non-interactive installations
ENV DEBIAN_FRONTEND=noninteractive
# Update and install prerequisites
RUN apt-get update && apt-get install -y \
software-properties-common \
wget \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Add the deadsnakes PPA for Python versions
RUN add-apt-repository ppa:deadsnakes/ppa -y && \
apt-get update && apt-get install -y \
python3.10 \
python3.10-distutils \
python3.10-dev \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
# Ensure pip is up-to-date
RUN python3.10 -m pip install --upgrade pip
# Set Python 3.10 as the default
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 && \
update-alternatives --config python3
# Verify Python and pip versions
RUN python3 --version && pip --version
# Update and install system dependencies
RUN apt-get update && apt-get install -y \
gdal-bin \
libgdal-dev \
python3-tk \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Set GDAL version to match installed system version
RUN gdalinfo --version && \
export CPLUS_INCLUDE_PATH=/usr/include/gdal && \
export C_INCLUDE_PATH=/usr/include/gdal
# Set a working directory
WORKDIR /app
COPY api/requirements.txt .
RUN pip install -r requirements.txt
COPY .env ./
COPY api/ ./
ENV PYTHONUNBUFFERED=1
EXPOSE 5000
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "5000"]