ketr.photos/Dockerfile
James Ketrenos 5f1d9e3c92 Added BASE_PATH support
Signed-off-by: James Ketrenos <james_git@ketrenos.com>
2023-01-19 01:38:32 -08:00

95 lines
2.1 KiB
Docker

FROM ubuntu:jammy
RUN apt-get update \
&& DEBIAN_FRONTEND=NONINTERACTIVE apt-get upgrade -y
RUN DEBIAN_FRONTEND=NONINTERACTIVE apt-get install -y \
wget \
pip \
libgl1 \
libglib2.0-0 \
nginx \
rsync \
less \
git \
sqlite3
# Upgrade Node
RUN wget -qO- https://deb.nodesource.com/setup_18.x | bash -
RUN DEBIAN_FRONTEND=NONINTERACTIVE apt-get install -y \
python2 \
jhead \
nodejs \
jq \
nano \
shellinabox \
nginx \
curl \
less
# Install the latest npm and npx
RUN npm install --global npm@latest
# Install deepface
RUN pip install deepface
RUN pip install piexif
# numpy 1.24 deprecated float; deepface is still using it, so we need to
# install <1.24
RUN pip install "numpy<1.24"
COPY /package*json /website/
WORKDIR /website
RUN npm upgrade && npm install
WORKDIR /website/client
COPY /client/package*json /website/client/
RUN npm upgrade && npm install
COPY /server /website/server
WORKDIR /website/server
RUN npm upgrade && npm install
COPY /config/default.json /website/config/default.json
COPY /*js /website/
COPY /src /website/src
COPY /client/public /website/client/public
COPY /client/src /website/client/src
COPY /scanner /website/scanner
COPY /frontend /website/frontend
COPY /ketrface /website/ketrface
# Switch to bash instead of sh
SHELL [ "/bin/bash", "-c" ]
ARG DEVELOPMENT=
RUN cp /website/server/nginx.conf /etc/nginx/sites-enabled/default
# If not DEVELOPMENT mode, copy production config, else development
RUN \
if [[ -z "${DEVELOPMENT}" ]]; then \
echo "Building PRODUCTION" ; \
cp /website/server/production.location \
/etc/nginx/snippets/active.location ; \
else \
echo "Building DEVELOPMENT" ; \
cp /website/server/development.location \
/etc/nginx/snippets/active.location ; \
fi
# If not DEVELOPMENT mode, then locally build project
RUN \
if [[ -z "${DEVELOPMENT}" ]]; then \
cd /website/client ; \
npm run build ; \
fi
COPY /scripts /opt/scripts
ENV PATH="${PATH}:/opt/scripts"
# In DEVELOPMENT mode, entrypoint launches 'npm start'
COPY /entrypoint.sh /
CMD [ "/entrypoint.sh" ]