I try to deploy a django application on heroku using a build manifest. The application seems to be deployed correctly, but the commands in the release phase do not seem to be executed.
This is my heroku.yml:
build:
docker:
web: Dockerfile
release:
image: web
command:
- python manage.py migrate
- python manage.py collectstatic --noinput
run:
web: gunicorn hello_django.wsgi:application --bind 0.0.0.0:$PORT
This is my Dockerfile:
FROM python:3.9-slim
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONBUFFERED 1
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
postgresql-client \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /usr/src/app
# install dependencies
RUN pip install --upgrade pip
COPY requirements.txt ./
RUN pip install -r requirements.txt
# copy source code to container
COPY ./src .
# create directory for statics
RUN mkdir staticfiles
The commands specified in the release phase are not executed. I know that, because the database is not being migrated and the staticfiles directory is empty. I also know that the rest of my application is actually configured correctly, because when I include this line in my Dockerfile at the end:
RUN python manage.py collectstatic
then the statics are collected and the application is running.
I also installed the plugin heroku-manifest with this command:
heroku plugins:install @heroku-cli/plugin-manifest and set the stack of my app to container with heroku stack:set container -a <app name>
What am I missing?
Update
actually it seems the migrate command is executed, but not collectstatic. Why is that?