Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
File size: 6,024 Bytes
d953aa6 fc7515d 29289c3 fc7515d 4d4579e fc7515d 802d0fd 29289c3 fc7515d 4d4579e 8380e8f 12979e8 69bfcb9 12979e8 fc7515d 4dc660b 12979e8 05df188 2de9026 12979e8 | 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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | FROM heartexlabs/label-studio:hf-latest
# Debugging— keeping persistent storage in gcloud
USER root
# jq for parsing json credentials, maybe unnecessary?
RUN apt-get update && apt-get install -y jq || true
RUN mkdir -p /label-studio/data && \
chown -R 1001:0 /label-studio/data && \
chmod -R 770 /label-studio/data
USER 1001
# start with local temp storage, although instance data will go to sql database
ENV LABEL_STUDIO_BASE_DATA_DIR=/tmp
# this ostensibly prevents users getting logged out when container restarts
ENV SECRET_KEY=${SECRET_KEY}
# gcp credentials (actual credentials get copied here from container secret)
ENV GOOGLE_APPLICATION_CREDENTIALS=/tmp/gcp-key.json
ENV DJANGO_DB_ENGINE=${DJANGO_DB_ENGINE}
ENV POSTGRE_NAME=${POSTGRES_NAME}
ENV POSTGRE_USER=${POSTGRES_USER}
ENV POSTGRE_PASSWORD=${POSTGRES_PASSWORD}
ENV POSTGRE_HOST=${POSTGRES_HOST}
ENV POSTGRE_PORT=5432
# copy gcp credentials and boots the app connected to Postgres
CMD sh -c 'echo "$GCP_SECRET_KEY" > /tmp/gcp-key.json && label-studio'
################################################################################
#
# How to Disable Public Account Creation
# --------------------------------------
# By default this space allows for the unrestricted creation of new accounts
# will full access to all projects and data. This is great for trying out
# Label Studio and collaborating on projects, but you may want to restrict
# access to your space to only authorized users. Uncomment the following line
# to disable public account creation for this space.
#
ENV LABEL_STUDIO_DISABLE_SIGNUP_WITHOUT_LINK=true
#
# Set secrets in your space to create an inital user, and log in with your
# provided username and password. Do not set these in your Dockerfile, as they
# globally visible on a public space.
#
# LABEL_STUDIO_USERNAME
# LABEL_STUDIO_PASSWORD
#
# You will need to provide new users with an invitation link to join the space.
#
################################################################################
################################################################################
#
# How to Enable Persistent Storage for Label Studio in Hugging Face Spaces
# ------------------------------------------------------------------------
#
# By default this space stores all project configuration and data annotations
# in local storage with sqlite. If the space is reset, all configuration and
# annotation data in the space will be lost. You can enable configuration
# persistence through one of two methods:
#
# 1) Enabling Hugging Face Persistent Storage for saving project and annotation
# settings, as well as local task storage.
# 2) Connecting an external Postgres database for saving project and annotation
# settings, and cloud by connecting cloud storage for tasks.
#
################################################################################
################################################################################
#
# How to Enable Hugging Face Persistent Storage for Label Studio
# --------------------------------------------------------------
#
# In the Hugging Face Label Studio Space settings, select the appropriate
# Persistent Storage tier. Note that Persistent Storage is a paid add-on.
# By default, persistent storage is mounted to /data. In your Space settings,
# set the following variables:
#
# ENV LABEL_STUDIO_BASE_DATA_DIR=/tmp
ENV STORAGE_PERSISTENCE=1
#
# Your space will restart. NOTE: if you have existing settings and data,
# they will be lost in this first restart. Data and setting will only be
# preserved on subsequent restarts of the space.
#
################################################################################
################################################################################
#
# How to Enable Configuration Persistence with Postgres
# -----------------------------------------------------
#
# Set the following secret variables to match your own hosted instance of
# Postgres. We strongly recommend setting these as secrets to prevent leaking
# information about your database service to the public in your spaces
# definition.
#
# ENV DJANGO_DB=default
# ENV POSTGRE_NAME=<postgres_name>
# ENV POSTGRE_PORT=<db_port>
# ENV POSTGRE_USER=<postgres_user>
# ENV POSTGRE_PASSWORD=<password>
# ENV POSTGRE_PORT=<db_port>
# ENV POSTGRE_HOST=<db_host>
#
# Uncomment the following line or set the following Space variable to remove
# the warning about ephemeral storage
#
# ENV STORAGE_PERSISTENCE=1
#
# Note that you will need to connect cloud storage to host data items that you
# want to annotate, as local storage will not be preserved across a space reset.
#
#
# How to Enable Cloud Storage
# ---------------------------
# By default the only data storage enabled for this space is local. In the case
# of a space reset, all data will be lost. To enable permanent storage, you
# must enable a cloud storage connector. We also strongly recommend enabling
# configuration persistence to preserve project data, annotations, and user
# settings. Choose the appropriate cloud connector and configure the secrets
# for it.
#
# Amazon S3
# =========
# STORAGE_TYPE=s3
# STORAGE_AWS_ACCESS_KEY_ID="<YOUR_ACCESS_KEY_ID>"
# STORAGE_AWS_SECRET_ACCESS_KEY="<YOUR_SECRET_ACCESS_KEY>"
# STORAGE_AWS_BUCKET_NAME="<YOUR_BUCKET_NAME>"
# STORAGE_AWS_REGION_NAME="<YOUR_BUCKET_REGION>"
# STORAGE_AWS_FOLDER=""
#
# Google Cloud Storage
# ====================
#
# STORAGE_TYPE=gcs
# STORAGE_GCS_BUCKET_NAME="smh-labeling"
# STORAGE_GCS_PROJECT_ID="social-media-harms"
# STORAGE_GCS_FOLDER="config"
# GOOGLE_APPLICATION_CREDENTIALS="this is configured elsewhere"
#
# Azure Blob Storage
# ==================
#
# STORAGE_TYPE=azure
# STORAGE_AZURE_ACCOUNT_NAME="<YOUR_STORAGE_ACCOUNT>"
# STORAGE_AZURE_ACCOUNT_KEY="<YOUR_STORAGE_KEY>"
# STORAGE_AZURE_CONTAINER_NAME="<YOUR_CONTAINER_NAME>"
# STORAGE_AZURE_FOLDER=""
#
################################################################################
CMD exec label-studio --host=$SPACE_HOST
|