Moved environment variables to .env.template for better management and updated docker-compose files to use them. Added separate docker-compose.dev.yml for development, a Makefile for streamlined commands, and split backend Dockerfile into development and production stages. Updated .gitignore to include new changes.
34 lines
1.0 KiB
Docker
34 lines
1.0 KiB
Docker
# Development stage
|
|
FROM python:3.12-slim AS development
|
|
WORKDIR /app
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PYTHONPATH=/app
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends gcc postgresql-client && \
|
|
apt-get clean && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
COPY . .
|
|
COPY entrypoint.sh /usr/local/bin/
|
|
RUN chmod +x /usr/local/bin/entrypoint.sh
|
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
|
|
|
# Production stage
|
|
FROM python:3.12-slim AS production
|
|
WORKDIR /app
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PYTHONPATH=/app
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends postgresql-client && \
|
|
apt-get clean && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
COPY . .
|
|
COPY entrypoint.sh /usr/local/bin/
|
|
RUN chmod +x /usr/local/bin/entrypoint.sh
|
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] |