-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
77 lines (66 loc) · 1.67 KB
/
Dockerfile
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Use the official Python image from the Docker Hub
FROM python:3.12-slim
RUN if id -u 1000 &> /dev/null; then \
uid=$(shuf -i 1001-65535 -n 1) \
&& useradd -m -u $uid user; \
else \
useradd -m -u 1000 user; \
fi
# Set the working directory inside the container
# install apt dependencies
RUN apt-get update && apt-get install -y \
build-essential \
libpq-dev \
libffi-dev \
libssl-dev \
libxml2-dev \
libxslt1-dev \
zlib1g-dev \
libjpeg-dev \
libfreetype6-dev \
liblcms2-dev \
libopenjp2-7-dev \
libtiff5-dev \
libwebp-dev \
libharfbuzz-dev \
libfribidi-dev \
tcl8.6-dev \
tk8.6-dev \
python3-tk \
python3-dev \
python3-pip \
python3-setuptools \
python3-wheel \
python3-cffi \
python3-cryptography \
python3-openssl \
python3-lxml \
python3-pillow \
python3-numpy \
python3-scipy \
python3-matplotlib \
python3-pandas \
python3-sqlalchemy \
python3-psycopg2 \
python3-redis \
python3-requests \
python3-flask \
python3-flask-cors \
python3-flask-restful
# Set the working directory in the container
WORKDIR /app
# Copy the requirements.txt file into the container at /app
COPY --chown=user requirements.txt requirements.txt
# Install the dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application code into the container at /app
COPY --chown=user . .
USER user
# Set environment variables for Flask
ENV FLASK_APP=server.py
ENV FLASK_RUN_HOST=0.0.0.0
ENV FLASK_RUN_PORT=7860
# Expose port 7860 to the outside world
EXPOSE 7860
# Run the application
CMD ["python3", "server.py"]