FROM python:3.11
# RUN python -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"

# RUN platformio platforms install atmelavr \
# 	--with-package framework-arduinoavr

# RUN platformio platforms install ststm32 \
# 	--with-package framework-libopencm3 \
# 	--with-package framework-spl \
# 	--with-package framework-cmsis \
# 	--with-package framework-mbed
# Install PlatformIO
RUN pip install platformio

# Install OpenSSH for remote access
RUN apt-get update && apt-get install -y openssh-server && rm -rf /var/lib/apt/lists/*

# Set up SSH
# RUN mkdir /var/run/sshd
# Create user 'platformio' with password 'platformio' and add to sudo
RUN useradd -m -s /bin/bash platformio \
	&& echo 'platformio:platformio' | chpasswd \
	&& adduser platformio sudo
# Allow password authentication for SSH and allow user 'platformio' to login
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config \
	&& sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config
EXPOSE 22

# Set working directory
WORKDIR /workspace

# SER platformio
CMD ["/usr/sbin/sshd", "-D"]
