This commit is contained in:
48
docker/ssh-server/Dockerfile
Normal file
48
docker/ssh-server/Dockerfile
Normal file
@@ -0,0 +1,48 @@
|
||||
# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
# ┃ 🐳 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", "/app/main.py"]
|
||||
|
||||
|
||||
#EXPOSE 22
|
||||
Reference in New Issue
Block a user