-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (38 loc) · 1.11 KB
/
Copy pathDockerfile
File metadata and controls
39 lines (38 loc) · 1.11 KB
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
# @file Dockerfile
# @brief Dockerfile for cadquery container
# @author 30hours
FROM ubuntu:24.10
WORKDIR /app
# prevent interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
# install system dependencies and Python
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
python3-dev \
python3-venv \
libgl1 \
libglx-mesa0 \
&& rm -rf /var/lib/apt/lists/*
# create and activate virtual environment
ENV VENV=/opt/venv
RUN python3 -m venv $VENV
ENV PATH="$VENV/bin:$PATH"
# install Python dependencies in the virtual environment
RUN pip install --no-cache-dir \
cadquery \
numpy \
flask \
gunicorn
EXPOSE 5000
# create cadquery user
RUN useradd -r -m -d /home/cadquery -s /bin/false cadquery \
&& chown -R cadquery:cadquery /home/cadquery /app
# copy files
COPY --chown=cadquery:cadquery app.py .
COPY --chown=cadquery:cadquery CadQueryValidator.py .
COPY --chown=cadquery:cadquery Preview.py .
# switch to non-root user cadquery
USER cadquery
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--workers", "2", \
"--threads", "4", "--timeout", "30", "app:app"]