danielkovtun's picture
fix: use micromamba base image with a user for permission management
722b2f2
raw
history blame contribute delete
862 Bytes
ARG BASE_IMAGE=mambaorg/micromamba
ARG BASE_TAG=1.5-jammy
ARG MAMBA_PYTHON_VERSION=3.10
FROM --platform=linux/amd64 ${BASE_IMAGE}:${BASE_TAG}
ARG MAMBA_PYTHON_VERSION
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /usr/src/app
# Install conda env
RUN micromamba install -y -n base -c conda-forge \
pyopenssl=23.2.0 \
python=${MAMBA_PYTHON_VERSION} \
requests=2.25.1 \
&& micromamba clean --all --yes
ARG MAMBA_DOCKERFILE_ACTIVATE=1 # (otherwise python will not be found)
ENV BASH_ENV=/usr/local/bin/_activate_current_env.sh
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/conda/lib
# install dependencies
ADD requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
EXPOSE 7860
ENV GRADIO_SERVER_NAME="0.0.0.0"
ADD . .
# Prepare user
USER $MAMBA_USER
ENTRYPOINT ["/usr/local/bin/_entrypoint.sh"]
CMD ["python", "inference_app.py"]