I have the following heroku.yml
file for containers deployment:
build:
docker:
release:
dockerfile: Dockerfile
target: release_image
web: Dockerfile
config:
PROD: "True"
release:
image: web
command:
- python manage.py collectstatic --noinput && python manage.py migrate users && python manage.py migrate
run:
# web: python manage.py runserver 0.0.0.0:$PORT
web: daphne config.asgi:application --port $PORT --bind 0.0.0.0 -v2
celery:
command:
- celery --app=my_app worker --pool=prefork --concurrency=4 --statedb=celery/worker.state -l info
image: web
celery_beat:
command:
- celery --app=my_app beat -l info
image: web
When I deploy I get the following warning, which does not make any sense to me:
Warning: You have declared both a release process type and a release section. Your release process type will be overridden.
My Dockerfile
is composed of two stages and I want to keep only the release_image
stage:
FROM python:3.8 as builder
...
FROM python:3.8-slim as release_image
...
According to the docs the proper way to choose release_image
is to use the target
section within build
step.
But it also mentions that I can run my migrations within a release
section.
So what am I supposed to do to get rid of this warning? I could only live with it if it was clear that both my migrations
and target
are being considered during deploy.Thanks in advance!
I want to keep only the
release_image
stage
Assuming this is true for your web
process as well, update your build
section accordingly:
build:
docker:
web:
dockerfile: Dockerfile
target: release_image
config:
PROD: "True"
Now you only have one process type defined and it targets the build stage you want to use.
Since you can run your migrations from the web
container there's no need to build a whole container just for your Heroku release
process. (And since your release
section uses the web
image the release
process defined in build
wouldn't have been for anything used anyway.)