Dockerized
This commit is contained in:
46
Dockerfile
Normal file
46
Dockerfile
Normal file
@@ -0,0 +1,46 @@
|
||||
FROM mambaorg/micromamba:1.5.10
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install FreeCAD + Python via conda-forge (headless)
|
||||
RUN micromamba create -y -n fc -c conda-forge \
|
||||
python=3.12 freecad \
|
||||
&& micromamba clean -a -y
|
||||
|
||||
# Activate env for subsequent RUN/CMD
|
||||
ENV MAMBA_DOCKERFILE_ACTIVATE=1
|
||||
SHELL ["/bin/bash", "-lc"]
|
||||
|
||||
# Install small OS deps (git for SheetMetal)
|
||||
# NOTE: do NOT switch users; keep it simple and reproducible
|
||||
USER root
|
||||
RUN mkdir -p /var/lib/apt/lists/partial \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y --no-install-recommends git ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Python deps into conda env
|
||||
COPY requirements.txt /app/requirements.txt
|
||||
RUN micromamba run -n fc pip install --no-cache-dir -r /app/requirements.txt
|
||||
|
||||
# App sources
|
||||
COPY . /app
|
||||
|
||||
# SheetMetal workbench (we'll link it into HOME at runtime)
|
||||
RUN mkdir -p /opt/freecad_mods \
|
||||
&& git clone --depth 1 https://github.com/shaise/FreeCAD_SheetMetal.git /opt/freecad_mods/SheetMetal
|
||||
|
||||
# Make FreeCAD find SheetMetal without any host volume
|
||||
ENV HOME=/opt/freecad_home
|
||||
RUN mkdir -p /opt/freecad_home/.local/share/FreeCAD/Mod \
|
||||
&& ln -s /opt/freecad_mods/SheetMetal /opt/freecad_home/.local/share/FreeCAD/Mod/SheetMetal
|
||||
|
||||
# Runtime env (overridable)
|
||||
ENV FREECADCMD=/opt/conda/envs/fc/bin/freecadcmd
|
||||
ENV FREECAD_TIMEOUT_SEC=1200
|
||||
ENV FREECAD_LOCK_FILE=/app/_jobs/.freecad.lock
|
||||
ENV HOME=/config
|
||||
|
||||
EXPOSE 5055
|
||||
|
||||
CMD ["bash", "-lc", "micromamba run -n fc gunicorn -w 1 --threads 4 -b 0.0.0.0:5055 app:app"]
|
||||
Reference in New Issue
Block a user