File size: 1,792 Bytes
57fc95b 8d1f0e0 57fc95b 49013e7 57fc95b 49013e7 57fc95b eaf6b79 57fc95b eaf6b79 57fc95b 8d1f0e0 57fc95b a27465f e748f03 7edb15c e748f03 57fc95b 3457e9d |
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 |
FROM python:3.10-slim
LABEL python_version=python3.10
RUN apt-get update && apt-get install -y \
build-essential \
curl \
wget \
software-properties-common \
git \
&& rm -rf /var/lib/apt/lists/*
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user
ENV PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
# Poetry virtual environment setup
ENV POETRY_NO_INTERACTION=1
ENV POETRY_HOME=$HOME/opt/env
ENV POETRY_CACHE_DIR=$HOME/opt/.cache
# mandatory !!
ENV POETRY_VIRTUALENVS_IN_PROJECT=1
RUN python3 -m venv $POETRY_HOME
RUN $POETRY_HOME/bin/pip install -U pip setuptools
RUN $POETRY_HOME/bin/pip install poetry==1.8.3
ENV PATH=$PATH:$POETRY_HOME/bin
COPY --chown=user pyproject.toml poetry.lock $HOME/app/
# creating the poetry virtual environment
RUN poetry install --without dev --no-root
ENV PATH=$HOME/app/.venv/bin:$PATH
ENV PYTHONPATH=.
# download vggface2 weights for Facenet embeddings
RUN mkdir -p ~/.cache/torch/checkpoints
RUN wget https://github.com/timesler/facenet-pytorch/releases/download/v2.2.9/20180402-114759-vggface2.pt -O ~/.cache/torch/checkpoints/20180402-114759-vggface2.pt
COPY --chown=user . $HOME/app/
# download needed data from Hugging Face
RUN wget https://huggingface.co/datasets/lajota13/lfw_facenet_embeddings/resolve/main/lfw_season_embeddings_train.parquet -O data/lfw_season_embeddings_train.parquet
# download season classifier weights
RUN wget https://huggingface.co/datasets/lajota13/lfw_facenet_embeddings/resolve/main/classifier_weights_v1.pt -O data/classifier_weights_v1.pt
HEALTHCHECK CMD curl --fail http://localhost:$PORT/_stcore/health
SHELL ["/bin/bash", "-c"]
ENTRYPOINT streamlit run seasonal_color_analysis/fe.py --server.port=$PORT --server.address=0.0.0.0 --server.enableXsrfProtection false |