added ARGs for BOOK_UID/BOOK_GID, uses sudo to make that usre and with a home dir, so that Cams install of chrome works using its home dir and Cams added google-chrome and requirements for selenium, etc

This commit is contained in:
2024-11-15 23:05:51 +11:00
parent 5c1e1627d9
commit f8ac24ab10

View File

@@ -1,10 +1,25 @@
FROM python
WORKDIR /code
ARG USERID
ARG GROUPID
RUN chown $USERID:$GROUPID /code
#RUN apt-get update && apt-get -y install python3-pip && apt-get -y dist-upgrade
COPY . .
RUN pip3 install -r requirements.txt
# declare var
ARG BOOK_UID
ARG BOOK_GID
WORKDIR /code
RUN groupadd -g ${BOOK_GID} pybook && useradd -m -u ${BOOK_UID} -g ${BOOK_GID} pybook
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN apt-get update && \
apt-get install -y ./google-chrome-stable_current_amd64.deb && \
apt-get install -f -y && \
apt-get install sudo && \
rm ./google-chrome-stable_current_amd64.deb && \
apt-get clean
RUN pip3 install --upgrade pip
RUN pip3 install -U -r requirements.txt
EXPOSE 80
# NOTE, wrapper.sh will use sudo to work in PROD and DEV AS the correct
# BOOK_UID/BOOK_GID as pybook user and group
CMD ["./wrapper.sh"]