I've having issues getting the live reloading to work when running the functions-framework inside a Docker container. I'm trying to set up a development environment using docker-compose. I am using the solution implemented here to be able to call all functions from one endpoint.
This is my Dockerfile:
# use alpine linux with standard python-3.9
FROM python:3.9-alpine
# install necessities and c compilers
RUN apk update && apk upgrade && apk add g++ gcc
# open up port 5000
EXPOSE 5000
# set working directory
WORKDIR /server
# copy files over
COPY requirements.txt /server/requirements.txt
# set env variables
ENV FLASK_ENV development
ENV DEBUG true
# install python dependencies
RUN pip install -r requirements.txt
# spin up gcloud functions server
CMD ["functions-framework", "--target=dispatcher", "--port=5000", "--debug"]
And inside docker-compose.yml I have this:
# functions server
functions:
container_name: functions
restart: always
ports:
- "5000:5000"
build:
context: ./
dockerfile: ./Dockerfile.dev
volumes:
- ./spottydata:/server/spottydata
- ./main.py:/server/main.py
networks:
- backend
I specified main.py as a mounted volume so it can see changes made during deployment, but nothing I do to that file triggers a hot reload. I wasn't sure if there were any examples running this in a docker container for development.
Thanks!
I've having issues getting the live reloading to work when running the
functions-frameworkinside a Docker container. I'm trying to set up a development environment usingdocker-compose. I am using the solution implemented here to be able to call all functions from one endpoint.This is my
Dockerfile:And inside
docker-compose.ymlI have this:I specified
main.pyas a mounted volume so it can see changes made during deployment, but nothing I do to that file triggers a hot reload. I wasn't sure if there were any examples running this in a docker container for development.Thanks!