File size: 1,011 Bytes
08c5221
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8ff169d
08c5221
8ff169d
 
 
 
 
08c5221
8ff169d
08c5221
 
 
 
 
 
 
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
FROM python:3.10-slim

ENV USER_ID=1000
ENV HOME=/home/user
ENV PATH=$HOME/.local/bin:$PATH

# AWS CLIとcode-serverの依存関係をインストール
RUN apt-get update && apt-get install -y \
    curl git sudo unzip \
    && curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
    && unzip awscliv2.zip && ./aws/install \
    && rm -rf awscliv2.zip ./aws \
    && rm -rf /var/lib/apt/lists/*

# code-serverインストール
RUN curl -fsSL https://code-server.dev/install.sh | sh

# UID 1000のユーザーを作成
RUN useradd -m -u $USER_ID user

# 修正ポイント: 必要なディレクトリを事前に作成し、権限を付与
RUN mkdir -p /home/user/.config /home/user/.local /home/user/app/workspace && \
    chown -R user:user /home/user

USER user
WORKDIR /home/user/app

# 同期スクリプトをコピー
COPY --chown=user:user entrypoint.sh /home/user/entrypoint.sh
RUN chmod +x /home/user/entrypoint.sh

EXPOSE 7860
ENTRYPOINT ["/home/user/entrypoint.sh"]