Support Docker Multistage target in render.yaml
Log In
M
Mitchel Cabuloy
For anyone using multi-stage builds, one workaround for not being able to set a target is to ensure that your "production" stage is the last build stage in your Dockerfile.
For example:
# Base stage
FROM python:3.9 as base
WORKDIR /app
COPY . .
RUN pip install -r requirements.txt
RUN python manage.py collectstatic --noinput
# Development stage
FROM base as dev
ENV DJANGO_SETTINGS_MODULE=config.settings.dev
RUN pip install -r requirements-dev.txt
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
# Production stage
FROM base as production
CMD ["gunicorn", "config.wsgi", "--bind", "0.0.0.0:8000"]