Description
I am trying to deploy my Flask web app to Google Cloud Run, but the Docker is not reading the .env
file containing the Gemini API key. The following image is my project directory.
Dockerfile
FROM python:3.11-slim
ENV PYTHONUNBUFFERED True
ENV APP_HOME /app
WORKDIR $APP_HOME
COPY . ./
# Install production dependencies.
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install Flask gunicorn
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 main:app
docker-compose.yml
services:
flask_app:
build:
context: .
dockerfile: Dockerfile.action
environment:
- GEMINI_API_KEY=${GEMINI_API_KEY}
I have almost zero experience in Docker so I’m not sure if I have configured the above files right. I would be grateful for your guidance to solve this issue.