Files
books/Dockerfile

30 lines
873 B
Docker

FROM python
WORKDIR /code
COPY . .
# declare var
ARG ENV
ARG BOOK_UID
ARG BOOK_GID
RUN groupadd -g ${BOOK_GID} pybook && useradd -m -u ${BOOK_UID} -g ${BOOK_GID} pybook
# in prod, /code will be owned by root and gunicorn logs wont work, so chg to pybook
RUN if [ "$ENV" = "production" ]; then \
chown -R pybook:pybook /code; \
fi
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"]