ssh server alpha
Some checks failed
/ build-docker-image (push) Failing after 23s

This commit is contained in:
2025-09-06 23:32:31 +00:00
parent ea24e0e41a
commit f6e6d4dba9
20 changed files with 643 additions and 4 deletions

View File

@@ -0,0 +1,75 @@
# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
# ┃ 🐳 Dockerfile: Multi-Stage Build for Python + SSH App /(dev) ┃
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
# ──────────────── Stage 1: Base ────────────────
# Base image using Debian Bullseye
FROM debian:bullseye as base
# Suppress interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
# Install core dependencies:
# - Python 3 and pip
# - OpenSSH server for remote access
# - sudo for privilege escalation
RUN apt-get update && \
apt-get install -y \
python3 \
python3-pip \
openssh-server \
sudo && \
mkdir /var/run/sshd && \
apt-get clean
# Create config directory for app (can be used by dev/prod stages)
RUN mkdir -p /etc/app/config
# ──────────────── Stage 2: Dev ────────────────
# Development stage inherits from base
FROM base AS dev
# Install debugging tools (e.g. debugpy for remote debugging)
RUN echo "Installing debug tools..." && \
pip install debugpy
# Set working directory
WORKDIR /app
# Install Python dependencies from requirements.txt
COPY app/requirements.txt requirements.txt
# This allows caching of dependencies even if app code is mounted
RUN pip install --no-cache-dir -r requirements.txt
EXPOSE 5678
# runtime environment
ENV CONFIGURATION=Debug
ENV DEBUG=True
# Default command for dev container
CMD ["python3", "/app/main.py"]
# ──────────────── Optional: User & SSH Setup ────────────────
# Uncomment below to create a non-root user and configure SSH access
# Create a non-root user with sudo privileges
# RUN useradd -m -s /bin/bash devuser && \
# echo "devuser:devpass" | chpasswd && \
# usermod -aG sudo devuser
# Configure SSH server to allow password login and specific users
# RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin no/' /etc/ssh/sshd_config && \
# sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config && \
# echo "AllowUsers devuser" >> /etc/ssh/sshd_config
# Expose SSH port