FROM node:21

RUN apt-get update \
	&& apt-get install -y --no-install-recommends openssh-server \
	&& rm -rf /var/lib/apt/lists/* \
	&& mkdir -p /var/run/sshd \
	&& useradd -m -s /bin/bash codex \
	&& mkdir -p /home/codex/.ssh \
	&& chown -R codex:codex /home/codex/.ssh \
	&& chmod 700 /home/codex/.ssh \
	&& sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config \
	&& sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin no/' /etc/ssh/sshd_config

# アプリケーションディレクトリを作成する
RUN mkdir -p /usr/src/node
WORKDIR /usr/src/node

RUN yarn install
EXPOSE 3000
EXPOSE 22
