I'm having difficulty setting an env var prior to running a gunicorn command in docker (1.29). My docker-compose file, which contains my Django/Python startup looks like the below ...
web:
restart: always
build: ./web
ports: # to access the container from outside
- "8000:8000"
env_file: .env
environment:
DEBUG: 'true'
SERVICE_CREDS_JSON_FILE: '/my-app/credentials.json'
command: PYTHONPATH=`pwd`/..
/usr/local/bin/gunicorn directory.wsgi:application --reload -w 2 -b :8000
My web/Dockerfile looks like this
FROM python:3.9-slim
RUN apt-get update && apt-get install
RUN apt-get install -y dos2unix
RUN apt-get update \
&& apt-get install -y --no-install-recommends gcc g++ libgdal-dev libffi-dev \
&& rm -rf /var/lib/apt/lists/*
RUN python -m pip install --upgrade pip
WORKDIR /my-app/
COPY . /my-app
RUN python -m pip install -r requirements.txt
RUN dos2unix /my-app/entrypoint.sh
ENTRYPOINT ["bash", "/my-app/entrypoint.sh"]
However, when I run
docker-compose up
I get this error
/my-app/entrypoint.sh: line 9: /app/PYTHONPATH=`pwd`/..: No such file or directory
maps_web_1 exited with code 127
How do I execute setting the env var appropriately as well as running my gunicorn command?