auto-labeler / Dockerfile
dillonlaird's picture
switch to root to add permissions
c758574
FROM node:slim
RUN apt-get update && apt-get install -y python3 python3-pip python3-venv ffmpeg libsm6 libxext6 pkg-config libpixman-1-dev libcairo2-dev libpango1.0-dev libgif-dev
RUN useradd -m -u 1001 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
COPY --chown=user . $HOME/app
# python setup
COPY requirements.txt $HOME/app/requirements.txt
RUN python3 -m venv .venv
RUN $HOME/app/.venv/bin/pip3 install --no-cache --upgrade -r $HOME/app/requirements.txt
# nextjs setup
WORKDIR $HOME/app/instance-labeler
RUN yarn install && yarn build
WORKDIR $HOME/app
# need this because I cannot create user 1000 because it's
# already taken by node, and user 1001 does not seem to have
# permissions to write files
USER root
RUN chmod 777 $HOME/app
USER user
CMD ["/home/user/app/.venv/bin/python3", "main.py"]