Added auth, environment brief, docker for db_migrations,frontend,backend.

This commit is contained in:
2025-12-15 23:40:34 +01:00
parent 3ab81fad8c
commit 1a5bef277d
36 changed files with 1059 additions and 132 deletions

49
Dockerfile Normal file
View File

@@ -0,0 +1,49 @@
# Django Backend Dockerfile
FROM ghcr.io/astral-sh/uv:python3.13-alpine AS builder
WORKDIR /app
ENV UV_COMPILE_BYTECODE=1
# Copy dependency files
COPY pyproject.toml uv.lock ./
# Install dependencies
RUN uv sync --frozen --no-dev --no-install-project
# Copy application code
COPY iotDashboard/ ./iotDashboard/
COPY manage.py ./
COPY create_user.py ./
# Sync the project
RUN uv sync --frozen --no-dev
# Stage 2: Runtime
FROM python:3.13-alpine
WORKDIR /app
# Install runtime dependencies
RUN apk add --no-cache postgresql-client
# Copy virtual environment and application
COPY --from=builder /app/.venv /app/.venv
COPY --from=builder /app/iotDashboard/ /app/iotDashboard/
COPY --from=builder /app/manage.py /app/
COPY --from=builder /app/create_user.py /app/
# Create non-root user
RUN adduser -D -u 1000 appuser && \
chown -R appuser:appuser /app
USER appuser
ENV PATH="/app/.venv/bin:$PATH"
ENV PYTHONUNBUFFERED=1
EXPOSE 3000
# Run Django with uvicorn for ASGI
CMD ["python", "-m", "uvicorn", "iotDashboard.asgi:application", "--host", "0.0.0.0", "--port", "3000"]