Learn by Directing AI
All materials

Dockerfile

Dockerfile
FROM python:3.11

# Database credentials hardcoded -- HARD-ML.3 target
ENV DATABASE_URL=postgresql://ehr_user:ehr_pass_2024@postgres:5432/ehr_db

# Install SSH server for remote access
RUN apt-get update && apt-get install -y openssh-server && \
    mkdir /var/run/sshd && \
    echo 'clinic:clinic123' | chpasswd && \
    useradd -m -s /bin/bash clinic || true && \
    echo 'clinic:clinic123' | chpasswd && \
    sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config && \
    sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config

WORKDIR /app

COPY app/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY app/ .

EXPOSE 5000
EXPOSE 22

# Runs as root -- HARD-ML.1 target
CMD service ssh start && gunicorn --bind 0.0.0.0:5000 app:app