Files
ssh/docker/ssh-server/Dockerfile
Márcio Fernandes 931008dbd1
All checks were successful
/ ssh-client-container (push) Successful in 9s
/ ssh-server-container (push) Successful in 9s
.
2025-09-07 00:19:28 +00:00

49 lines
1.6 KiB
Docker

# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
# ┃ 🐳 Dockerfile: Multi-Stage Build for Python + SSH App ┃
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
# ──────────────── 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: Prod ────────────────
# Production stage inherits from base
FROM base AS prod
# Copy full app code into image (self-contained)
COPY app/ /app
# Set working directory
WORKDIR /app
RUN pip install --no-cache-dir -r requirements.txt
ENV CONFIGURATION=Production
ENV DEBUG=False
# Default command for production container
CMD ["python3", "-u", "/app/main.py"]
#EXPOSE 22