Timothy S. Phan commited on
Commit ·
6979235
1
Parent(s): 11b3640
Label Studio with S3 backup and signup disabled
Browse files- Dockerfile +27 -131
Dockerfile
CHANGED
|
@@ -1,140 +1,36 @@
|
|
| 1 |
FROM heartexlabs/label-studio:hf-latest
|
| 2 |
|
| 3 |
-
#
|
| 4 |
USER root
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
&&
|
| 12 |
-
|
| 13 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
USER 1001
|
| 15 |
|
| 16 |
-
#
|
| 17 |
-
#
|
| 18 |
-
#
|
| 19 |
-
# --------------------------------------
|
| 20 |
-
# By default this space allows for the unrestricted creation of new accounts
|
| 21 |
-
# will full access to all projects and data. This is great for trying out
|
| 22 |
-
# Label Studio and collaborating on projects, but you may want to restrict
|
| 23 |
-
# access to your space to only authorized users. Uncomment the following line
|
| 24 |
-
# to disable public account creation for this space.
|
| 25 |
-
#
|
| 26 |
ENV LABEL_STUDIO_DISABLE_SIGNUP_WITHOUT_LINK=true
|
| 27 |
-
#
|
| 28 |
-
# Set secrets in your space to create an inital user, and log in with your
|
| 29 |
-
# provided username and password. Do not set these in your Dockerfile, as they
|
| 30 |
-
# globally visible on a public space.
|
| 31 |
-
#
|
| 32 |
-
# LABEL_STUDIO_USERNAME
|
| 33 |
-
# LABEL_STUDIO_PASSWORD
|
| 34 |
-
#
|
| 35 |
-
# You will need to provide new users with an invitation link to join the space.
|
| 36 |
-
#
|
| 37 |
-
################################################################################
|
| 38 |
-
|
| 39 |
-
################################################################################
|
| 40 |
-
#
|
| 41 |
-
# How to Enable Persistent Storage for Label Studio in Hugging Face Spaces
|
| 42 |
-
# ------------------------------------------------------------------------
|
| 43 |
-
#
|
| 44 |
-
# By default this space stores all project configuration and data annotations
|
| 45 |
-
# in local storage with sqlite. If the space is reset, all configuration and
|
| 46 |
-
# annotation data in the space will be lost. You can enable configuration
|
| 47 |
-
# persistence through one of two methods:
|
| 48 |
-
#
|
| 49 |
-
# 1) Enabling Hugging Face Persistent Storage for saving project and annotation
|
| 50 |
-
# settings, as well as local task storage.
|
| 51 |
-
# 2) Connecting an external Postgres database for saving project and annotation
|
| 52 |
-
# settings, and cloud by connecting cloud storage for tasks.
|
| 53 |
-
#
|
| 54 |
-
################################################################################
|
| 55 |
-
|
| 56 |
-
################################################################################
|
| 57 |
-
#
|
| 58 |
-
# How to Enable Hugging Face Persistent Storage for Label Studio
|
| 59 |
-
# --------------------------------------------------------------
|
| 60 |
-
#
|
| 61 |
-
# In the Hugging Face Label Studio Space settings, select the appropriate
|
| 62 |
-
# Persistent Storage tier. Note that Persistent Storage is a paid add-on.
|
| 63 |
-
# By default, persistent storage is mounted to /data. In your Space settings,
|
| 64 |
-
# set the following variables:
|
| 65 |
-
#
|
| 66 |
-
# LABEL_STUDIO_BASE_DATA_DIR=/data
|
| 67 |
-
# ENV STORAGE_PERSISTENCE=1
|
| 68 |
-
#
|
| 69 |
-
# Your space will restart. NOTE: if you have existing settings and data,
|
| 70 |
-
# they will be lost in this first restart. Data and setting will only be
|
| 71 |
-
# preserved on subsequent restarts of the space.
|
| 72 |
-
#
|
| 73 |
-
################################################################################
|
| 74 |
|
| 75 |
-
#
|
| 76 |
-
|
| 77 |
-
# How to Enable Configuration Persistence with Postgres
|
| 78 |
-
# -----------------------------------------------------
|
| 79 |
-
#
|
| 80 |
-
# Set the following secret variables to match your own hosted instance of
|
| 81 |
-
# Postgres. We strongly recommend setting these as secrets to prevent leaking
|
| 82 |
-
# information about your database service to the public in your spaces
|
| 83 |
-
# definition.
|
| 84 |
-
#
|
| 85 |
-
# ENV DJANGO_DB=default
|
| 86 |
-
# ENV POSTGRE_NAME=<postgres_name>
|
| 87 |
-
# ENV POSTGRE_PORT=<db_port>
|
| 88 |
-
# ENV POSTGRE_USER=<postgres_user>
|
| 89 |
-
# ENV POSTGRE_PASSWORD=<password>
|
| 90 |
-
# ENV POSTGRE_PORT=<db_port>
|
| 91 |
-
# ENV POSTGRE_HOST=<db_host>
|
| 92 |
-
#
|
| 93 |
-
# Uncomment the following line or set the following Space variable to remove
|
| 94 |
-
# the warning about ephemeral storage
|
| 95 |
-
#
|
| 96 |
-
# ENV STORAGE_PERSISTENCE=1
|
| 97 |
-
#
|
| 98 |
-
# Note that you will need to connect cloud storage to host data items that you
|
| 99 |
-
# want to annotate, as local storage will not be preserved across a space reset.
|
| 100 |
-
#
|
| 101 |
-
#
|
| 102 |
-
# How to Enable Cloud Storage
|
| 103 |
-
# ---------------------------
|
| 104 |
-
# By default the only data storage enabled for this space is local. In the case
|
| 105 |
-
# of a space reset, all data will be lost. To enable permanent storage, you
|
| 106 |
-
# must enable a cloud storage connector. We also strongly recommend enabling
|
| 107 |
-
# configuration persistence to preserve project data, annotations, and user
|
| 108 |
-
# settings. Choose the appropriate cloud connector and configure the secrets
|
| 109 |
-
# for it.
|
| 110 |
-
#
|
| 111 |
-
# Amazon S3
|
| 112 |
-
# =========
|
| 113 |
-
# STORAGE_TYPE=s3
|
| 114 |
-
# STORAGE_AWS_ACCESS_KEY_ID="<YOUR_ACCESS_KEY_ID>"
|
| 115 |
-
# STORAGE_AWS_SECRET_ACCESS_KEY="<YOUR_SECRET_ACCESS_KEY>"
|
| 116 |
-
# STORAGE_AWS_BUCKET_NAME="<YOUR_BUCKET_NAME>"
|
| 117 |
-
# STORAGE_AWS_REGION_NAME="<YOUR_BUCKET_REGION>"
|
| 118 |
-
# STORAGE_AWS_FOLDER=""
|
| 119 |
-
#
|
| 120 |
-
# Google Cloud Storage
|
| 121 |
-
# ====================
|
| 122 |
-
#
|
| 123 |
-
# STORAGE_TYPE=gcs
|
| 124 |
-
# STORAGE_GCS_BUCKET_NAME="<YOUR_BUCKET_NAME>"
|
| 125 |
-
# STORAGE_GCS_PROJECT_ID="<YOUR_PROJECT_ID>"
|
| 126 |
-
# STORAGE_GCS_FOLDER=""
|
| 127 |
-
# GOOGLE_APPLICATION_CREDENTIALS="/opt/heartex/secrets/key.json"
|
| 128 |
-
#
|
| 129 |
-
# Azure Blob Storage
|
| 130 |
-
# ==================
|
| 131 |
-
#
|
| 132 |
-
# STORAGE_TYPE=azure
|
| 133 |
-
# STORAGE_AZURE_ACCOUNT_NAME="<YOUR_STORAGE_ACCOUNT>"
|
| 134 |
-
# STORAGE_AZURE_ACCOUNT_KEY="<YOUR_STORAGE_KEY>"
|
| 135 |
-
# STORAGE_AZURE_CONTAINER_NAME="<YOUR_CONTAINER_NAME>"
|
| 136 |
-
# STORAGE_AZURE_FOLDER=""
|
| 137 |
-
#
|
| 138 |
-
################################################################################
|
| 139 |
|
| 140 |
-
|
|
|
|
|
|
| 1 |
FROM heartexlabs/label-studio:hf-latest
|
| 2 |
|
| 3 |
+
# ---------- install aws-cli + sqlite3 (run as root) ----------
|
| 4 |
USER root
|
| 5 |
|
| 6 |
+
RUN apt-get update && \
|
| 7 |
+
apt-get install -y --no-install-recommends curl unzip sqlite3 && \
|
| 8 |
+
# AWS CLI v2
|
| 9 |
+
curl -Lo /tmp/awscliv2.zip https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip && \
|
| 10 |
+
unzip -q /tmp/awscliv2.zip -d /tmp && \
|
| 11 |
+
/tmp/aws/install && \
|
| 12 |
+
rm -rf /tmp/aws /tmp/awscliv2.zip && \
|
| 13 |
+
# Create /data and hand ownership to the LS user before switching
|
| 14 |
+
mkdir -p /data && \
|
| 15 |
+
chown -R 1001:0 /data && \
|
| 16 |
+
chmod -R 775 /data && \
|
| 17 |
+
apt-get clean && \
|
| 18 |
+
rm -rf /var/lib/apt/lists/*
|
| 19 |
+
|
| 20 |
+
# ---------- copy our entrypoint wrapper ----------
|
| 21 |
+
COPY entrypoint.sh /entrypoint.sh
|
| 22 |
+
RUN chmod +x /entrypoint.sh
|
| 23 |
+
|
| 24 |
+
# ---------- switch back to the non-root LS user (matches official image) ----------
|
| 25 |
USER 1001
|
| 26 |
|
| 27 |
+
# ---------- signup disabled by default: only admin-invited users can log in ----------
|
| 28 |
+
# Protects a Public HF Space — strangers reach the login screen but cannot
|
| 29 |
+
# self-register. Remove or set to "false" only if you want open registration.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
ENV LABEL_STUDIO_DISABLE_SIGNUP_WITHOUT_LINK=true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
+
# ---------- tell Label Studio where its data lives ----------
|
| 33 |
+
ENV LABEL_STUDIO_BASE_DATA_DIR=/data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
+
# ---------- run our backup-wrapper instead of the default CMD ----------
|
| 36 |
+
CMD ["/entrypoint.sh"]
|