danielkovtun
commited on
Commit
•
722b2f2
1
Parent(s):
56e4d43
fix: use micromamba base image with a user for permission management
Browse files- Dockerfile +25 -1
Dockerfile
CHANGED
@@ -1,6 +1,25 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
WORKDIR /usr/src/app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
# install dependencies
|
5 |
ADD requirements.txt .
|
6 |
RUN pip install --no-cache-dir -r requirements.txt
|
@@ -10,4 +29,9 @@ ENV GRADIO_SERVER_NAME="0.0.0.0"
|
|
10 |
|
11 |
ADD . .
|
12 |
|
|
|
|
|
|
|
|
|
|
|
13 |
CMD ["python", "inference_app.py"]
|
|
|
1 |
+
ARG BASE_IMAGE=mambaorg/micromamba
|
2 |
+
ARG BASE_TAG=1.5-jammy
|
3 |
+
ARG MAMBA_PYTHON_VERSION=3.10
|
4 |
+
|
5 |
+
FROM --platform=linux/amd64 ${BASE_IMAGE}:${BASE_TAG}
|
6 |
+
|
7 |
+
ARG MAMBA_PYTHON_VERSION
|
8 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
9 |
|
10 |
WORKDIR /usr/src/app
|
11 |
+
|
12 |
+
# Install conda env
|
13 |
+
RUN micromamba install -y -n base -c conda-forge \
|
14 |
+
pyopenssl=23.2.0 \
|
15 |
+
python=${MAMBA_PYTHON_VERSION} \
|
16 |
+
requests=2.25.1 \
|
17 |
+
&& micromamba clean --all --yes
|
18 |
+
|
19 |
+
ARG MAMBA_DOCKERFILE_ACTIVATE=1 # (otherwise python will not be found)
|
20 |
+
ENV BASH_ENV=/usr/local/bin/_activate_current_env.sh
|
21 |
+
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/conda/lib
|
22 |
+
|
23 |
# install dependencies
|
24 |
ADD requirements.txt .
|
25 |
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
29 |
|
30 |
ADD . .
|
31 |
|
32 |
+
# Prepare user
|
33 |
+
USER $MAMBA_USER
|
34 |
+
|
35 |
+
ENTRYPOINT ["/usr/local/bin/_entrypoint.sh"]
|
36 |
+
|
37 |
CMD ["python", "inference_app.py"]
|