noppodev commited on
Commit
22312ae
·
verified ·
1 Parent(s): 3c6a4f6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -8
Dockerfile CHANGED
@@ -1,19 +1,23 @@
1
  FROM ubuntu:22.04
2
 
3
- # 必要な道具(NBD:ネットワーク越しにデバイスを繋ぐ仕組み)をインストール
4
  RUN apt-get update && apt-get install -y nbd-server && apt-get clean
5
 
6
- # 16GBの「空のファイル」を作って、そこをメモリ貸し出し所にするぜ
7
- RUN fallback_file="/tmp/memory_pool" && \
8
- truncate -s 16G $fallback_file
9
 
10
- # Hugging Faceのポートルールに合わせて、外部から接続できように設定
11
  RUN echo '[generic]\n\
12
  user = root\n\
13
  group = root\n\
14
  [export]\n\
15
  exportname = /tmp/memory_pool\n\
16
- port = 7860' > /etc/nbd-server/config
 
17
 
18
- # サーバー起動!
19
- CMD ["nbd-server", "-C", "/etc/etc/nbd-server/config"]
 
 
 
 
 
 
1
  FROM ubuntu:22.04
2
 
 
3
  RUN apt-get update && apt-get install -y nbd-server && apt-get clean
4
 
5
+ # 16GBの領域確保
6
+ RUN truncate -s 16G /tmp/memory_pool
 
7
 
8
+ # 0.0.0.0で全方位から受け付ける設定
9
  RUN echo '[generic]\n\
10
  user = root\n\
11
  group = root\n\
12
  [export]\n\
13
  exportname = /tmp/memory_pool\n\
14
+ port = 7860\n\
15
+ authfile = /etc/nbd-server/allow' > /etc/nbd-server/config
16
 
17
+ # 誰でも接続OKにする(とりあえずテスト用)
18
+ RUN touch /etc/nbd-server/allow && echo "0.0.0.0/0" > /etc/nbd-server/allow
19
+
20
+ # 7860ポートを強制的に開放
21
+ EXPOSE 7860
22
+
23
+ CMD ["nbd-server", "-d", "-C", "/etc/nbd-server/config"]