Maki commited on
Commit
61d6484
1 Parent(s): 7d6de36

[refactor] Dockerfileの最適化とパーミッションの調整

Browse files

Dockerfileを最適化し、必要なパッケージのインストールとパーミッションの設定を行いました。

変更内容:
- 不要な `USER root` コマンドを削除
- `RUN pip install streamlit --break-system-packages` を `RUN pip3 install streamlit --break-system-packages` に変更
- `ENV PATH="/home/user/.local/bin:${PATH}"` を追加して、pipでインストールしたパッケージを使用できるようにパスを設定
- `USER root` と `USER node` を追加して、必要なパーミッションを設定
- `/app` と `/usr/local/lib/node_modules/@slidev/` のパーミッションを777に変更し、ユーザーがアクセスできるように設定
- `RUN npx playwright install` を `USER node` の後に移動し、適切なユーザーでインストールを実行

Files changed (1) hide show
  1. Dockerfile +7 -4
Dockerfile CHANGED
@@ -1,6 +1,5 @@
1
  # Dockerfile
2
  FROM node:18
3
-
4
  USER root
5
  RUN useradd -m -u 1001 user
6
  WORKDIR /app
@@ -18,7 +17,6 @@ RUN npx playwright install
18
  RUN chown -R user:user /app
19
  RUN chown -R user:user /usr/local/lib/node_modules/@slidev/
20
  USER user
21
-
22
  # Slidevのインストール
23
 
24
  RUN npm install -D playwright-chromium
@@ -29,8 +27,13 @@ RUN yes | npx slidev export slides/demo.md --format png --output slides/out/ --d
29
  RUN npm install
30
 
31
 
32
- RUN pip install streamlit --break-system-packages
33
  ENV PATH="/home/user/.local/bin:${PATH}"
34
-
 
 
 
 
 
35
 
36
  CMD ["python3", "-m", "streamlit", "run", "app.py"]
 
1
  # Dockerfile
2
  FROM node:18
 
3
  USER root
4
  RUN useradd -m -u 1001 user
5
  WORKDIR /app
 
17
  RUN chown -R user:user /app
18
  RUN chown -R user:user /usr/local/lib/node_modules/@slidev/
19
  USER user
 
20
  # Slidevのインストール
21
 
22
  RUN npm install -D playwright-chromium
 
27
  RUN npm install
28
 
29
 
30
+ RUN pip3 install streamlit --break-system-packages
31
  ENV PATH="/home/user/.local/bin:${PATH}"
32
+ USER root
33
+ RUN pip3 install streamlit --break-system-packages
34
+ RUN chmod 777 -R /app
35
+ RUN chmod 777 -R /usr/local/lib/node_modules/@slidev/
36
+ USER node
37
+ RUN npx playwright install
38
 
39
  CMD ["python3", "-m", "streamlit", "run", "app.py"]