Infrastructure: - docker-compose.yml: PostgreSQL in private network (RDS simulation) - Dockerfile: Alpine-based test image with postgresql-client Services: - app: nginx for testing database connection (multi-homed) - db: PostgreSQL 16 in private network (simulates RDS) - test-public: Alpine for isolation testing Key Features: - Private network with --internal flag (INF-02 compliant) - Named volume for data persistence (INF-04) - Resource limits: 2 vCPU, 4GB RAM (INF-03) - Non-root execution (INF-01) - NO ports exposed from database Parallels: - PostgreSQL container → RDS Instance - Private network → VPC Private Subnet - Named volume → EBS volume - Resource limits → DB instance class Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
27 lines
684 B
Docker
27 lines
684 B
Docker
# Dockerfile per Lab 05 - Database & RDS
|
|
# Nota: Lab 05 usa immagini ufficiali (PostgreSQL, Nginx, Alpine)
|
|
# Questo Dockerfile è fornito come reference per customizzazioni future
|
|
|
|
FROM alpine:3.19
|
|
|
|
# Creare utente non-root per sicurezza (INF-01 compliance)
|
|
RUN addgroup -g 1000 appgroup && \
|
|
adduser -D -u 1000 -G appgroup appuser
|
|
|
|
# Installare strumenti di test database
|
|
RUN apk add --no-cache \
|
|
postgresql-client \
|
|
curl \
|
|
netcat-openbsd \
|
|
bind-tools \
|
|
&& rm -rf /var/cache/apk/*
|
|
|
|
# Passare all'utente non-root
|
|
USER appuser
|
|
|
|
# Set working directory
|
|
WORKDIR /home/appuser
|
|
|
|
# Comando di default - container in attesa per testing
|
|
CMD ["sh", "-c", "sleep 3600"]
|