File size: 1,520 Bytes
fcac20b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
FROM docker.io/giskardai/giskard:2.7.7

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"]