File size: 966 Bytes
5c3ba51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# ベースイメージとして軽量なDebianを使用
FROM python:3.9-slim-bullseye

# 必要なツール(curl, git, sudoなど)をインストール
RUN apt-get update && apt-get install -y \
    curl \
    git \
    sudo \
    sqlite3 \
    build-essential \
    && rm -rf /var/lib/apt/lists/*

# code-server(VSCodeのWeb版)をインストール
RUN curl -fsSL https://code-server.dev/install.sh | sh

# ユーザーを作成(セキュリティのためrootではなく一般ユーザーで動かします)
RUN useradd -m -u 1000 user && \
    echo "user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

# Hugging Face Spaceはポート7860を使います
ENV PORT=7860
EXPOSE 7860

# 作業ディレクトリの設定
WORKDIR /home/user

# 起動スクリプトをコピーして実行権限を付与
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

# ユーザーを切り替え
USER user

# 起動コマンド
ENTRYPOINT ["/entrypoint.sh"]