dockerfiles added
This commit is contained in:
44
apps/abstraction/Dockerfile
Normal file
44
apps/abstraction/Dockerfile
Normal file
@@ -0,0 +1,44 @@
|
||||
# Abstraction Layer Dockerfile
|
||||
# MQTT ↔ Device Protocol Translation Worker
|
||||
|
||||
FROM python:3.14-alpine
|
||||
|
||||
# Prevent Python from writing .pyc files and enable unbuffered output
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
MQTT_BROKER=172.16.2.16 \
|
||||
MQTT_PORT=1883 \
|
||||
REDIS_HOST=localhost \
|
||||
REDIS_PORT=6379 \
|
||||
REDIS_DB=0
|
||||
|
||||
# Create non-root user
|
||||
RUN addgroup -g 10001 -S app && \
|
||||
adduser -u 10001 -S app -G app
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Install system dependencies
|
||||
RUN apk add --no-cache \
|
||||
gcc \
|
||||
musl-dev \
|
||||
linux-headers
|
||||
|
||||
# Install Python dependencies
|
||||
COPY apps/abstraction/requirements.txt /app/requirements.txt
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy application code
|
||||
COPY apps/__init__.py /app/apps/__init__.py
|
||||
COPY apps/abstraction/ /app/apps/abstraction/
|
||||
COPY packages/ /app/packages/
|
||||
|
||||
# Change ownership to app user
|
||||
RUN chown -R app:app /app
|
||||
|
||||
# Switch to non-root user
|
||||
USER app
|
||||
|
||||
# Run application
|
||||
CMD ["python", "-m", "apps.abstraction.main"]
|
||||
5
apps/abstraction/requirements.txt
Normal file
5
apps/abstraction/requirements.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
pydantic>=2
|
||||
aiomqtt==2.0.1
|
||||
redis==5.0.1
|
||||
pyyaml==6.0.1
|
||||
tenacity==8.2.3
|
||||
Reference in New Issue
Block a user