mica
November 5, 2021, 11:30am
1
Hi!
I’m trying to deploy my dockerized django app to render but it keeps failing.
The following is my render.yaml
#render.yaml
services:
- type: web
name: listikles
env: docker
region: oregon
plan: free
branch: master
dockerCommand: python manage.py collectstatic --no-input && python manage.py tailwind build && python manage.py runserver 0.0.0.0:8000
numInstances: 1
healthCheckPath: /
envVars:
- key: DEBUG
value: True
And that is the correct heroku.yml that I am trying to translate to render:
# heroku.yml
setup:
addons:
- plan: heroku-postgresql
build:
docker:
web: Dockerfile
release:
image: web
command:
- python manage.py collectstatic --noinput
run:
web: gunicorn config.wsgi
I don’t know what’s going on, I tried to put a script “build.sh” in the dockerCommand, but the deploy always fail without error message after pushing to registry.
mica
November 5, 2021, 12:26pm
2
After some tinkering, turns out my dockerCommand was wrong.
I didn’t catch that it is the CMD of a Dockerfile.
It ‘works’ with dockerCommand: gunicorn project.wsgi .
So my question is, where do I put those:
python manage.py migrate
python manage.py tailwind build
python manage.py collectstatic --no-input
mica
November 5, 2021, 11:59pm
3
The answer was…
#Dockerfile
...
RUN SECRET_KEY=nothing python manage.py tailwind install --no-input;
RUN SECRET_KEY=nothing python manage.py tailwind build --no-input;
RUN SECRET_KEY=nothing python manage.py collectstatic --no-input;
...
Before that, I tried with an ENTRYPOINT
COPY docker-entrypoint.sh /code/
ENTRYPOINT ["./docker-entrypoint.sh”]
CMD ["gunicorn", "project.wsgi"]
Which worked offline but not on render:
On render, ENTRYPOINT was successfully run, but the subsequent CMD was ignored.
2 Likes
Would you mind sharing your full dockerfile? I’m sure it would help many stumbling across this issue