35 lines
778 B
Docker
35 lines
778 B
Docker
# Calejo Control Adapter Dockerfile
|
|
|
|
FROM python:3.11-slim
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
gcc \
|
|
libpq-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy requirements and install Python dependencies
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy application code
|
|
COPY . .
|
|
|
|
# Create non-root user
|
|
RUN useradd -m -u 1000 calejo && chown -R calejo:calejo /app
|
|
USER calejo
|
|
|
|
# Expose ports
|
|
EXPOSE 8080 # REST API
|
|
EXPOSE 4840 # OPC UA
|
|
EXPOSE 502 # Modbus TCP
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD curl -f http://localhost:8080/health || exit 1
|
|
|
|
# Run the application
|
|
CMD ["python", "-m", "src.main"] |