Deploy Django App wih Dockerfile

I’m trying to deploy Django application with Dockerfile.

I have added the below codes in Dockerfile -

ARG PYTHON_VERSION=3.10-slim-buster

ARG DEBIAN_FRONTEND=noninteractive

FROM python:${PYTHON_VERSION}

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

RUN mkdir -p /code

WORKDIR /code

#install the linux packages, since these are the dependencies of some python packages
RUN apt-get update && apt-get install -y \
    libpq-dev \
    gcc \
    cron \
    wkhtmltopdf \
    && rm -rf /var/lib/apt/lists/* !

COPY requirements.txt /tmp/requirements.txt

RUN set -ex && \
    pip install --upgrade pip && \
    pip install -r /tmp/requirements.txt && \
    rm -rf /root/.cache/

COPY . /code

And added the below codes in render.toml,

[deploy]
startCommand = "sh /code/release.sh"

And, added the below in release.sh,

#!/usr/bin/env sh
python manage.py migrate
python manage.py collectstatic --noinput
python manage.py runserver 0.0.0.0:$PORT

But, after building, it’s not run/execute the release.sh.
What’s the proper way to implement this?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

render.toml isn’t something that will run automatically. /code/release.sh can be set as a CMD command in the Dockerfile or as a start command in the services settings.

Regards,

Keith
Render Support, UTC+10 :australia: