8000 Hot reloading doesn't work inside Docker container · Issue #142 · GoogleCloudPlatform/functions-framework-python · GitHub
[go: up one dir, main page]

Skip to content
Hot reloading doesn't work inside Docker container #142
Closed
@nleroy917

Description

@nleroy917

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0