giskard / Dockerfile
andreybavt's picture
Update Dockerfile
c78a72b
FROM docker.io/giskardai/giskard:2.0.5
USER root
RUN usermod -u 1000 giskard
RUN chown -R giskard \
/var/run/postgresql \
/var/lib/nginx \
"${GSK_USER_HOME}" \
"${GSK_DIST_PATH}"
# Use HF persistent storage under /data if mounted
ENV GISKARD_HF_DATA_DIR=/data/giskard/datadir
RUN mkdir -p "${GISKARD_HF_DATA_DIR}" && chown -R giskard "${GISKARD_HF_DATA_DIR}"
# Create or declare subdirs under GISKARD_HF_DATA_DIR
ENV PGDATA=$GISKARD_HF_DATA_DIR/database
RUN mkdir -p "${GISKARD_HF_DATA_DIR}/run" && chown -R giskard "${GISKARD_HF_DATA_DIR}/run"
# Keep the original GSK_HOME for supervisord run files
# We can still bring up supervisord in case of the persistent storage not working
ENV GSK_RUN=$GSK_HOME
RUN mkdir -p "${GSK_RUN}/run" && chown -R giskard "${GSK_RUN}/run"
USER giskard
# Only changed the original supervisord.conf to redirect logs to stdout
COPY --chown=giskard supervisord.conf $GSK_DIST_PATH
# Copy requirements for demo Space external worker
COPY --chown=giskard requirements.txt /requirements.txt
# Internal workr doesn't download resource, but takes them directly from projects, so no cache
ENV GSK_CACHE_DIR=projects
# Redirect to HF persistent storage for Python ($GSK_HOME) and Java ($GISKARD_HOME)
ENV GSK_HOME=$GISKARD_HF_DATA_DIR \
GISKARD_HOME=$GISKARD_HF_DATA_DIR
EXPOSE 7860
# Use a script to create dir and change owner in HF persistent storage during runtime
COPY --chown=giskard hf.sh "/giskard-bootstrap.sh"
ENTRYPOINT ["bash", "/giskard-bootstrap.sh"]