Skip to content
Snippets Groups Projects
Commit cfa3e468 authored by Sastry, Nishanth Prof (Comp Sci & Elec Eng)'s avatar Sastry, Nishanth Prof (Comp Sci & Elec Eng)
Browse files

move movies.py to /src + add volume to hot reload

parent dbc0a422
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,15 @@ services:
- "5001:5001"
networks:
- microservices-net #allows communication to all services on this network, ie, to stservice
#next let us make it such that we can edit the movie service and change it on the fly
environment:
FLASK_ENV: development #set flask env so that it reloads when source code changes
volumes:
- .:/src
# The above mapping should correspond to where py files are copied over in movieservice/Dockerfile
# Now, when the source code changes in host, it is reflected in the "/" working dir of the container
# This change is detected by Flask and reloads the movie service
# Note that this reloading does NOT happen for stservice below as it lacks this config!
stservice:
image: stservice-img
build:
......
......
......@@ -26,7 +26,9 @@ def movie_info(movieid):
result = movies[movieid]
result["uri"] = "/movies/{}".format(movieid)
#show that this change is visible. Uncomment the below and see the title change
#Note that you dont have to restart the container or service. Flask in dev mode restarts itself!
#result["title"] = "hello world"
return json.dumps(result)
......
......
......@@ -2,7 +2,7 @@ FROM python:3.8-alpine
WORKDIR /
COPY movieservice/requirements.txt .
RUN pip install -r requirements.txt
COPY ./movies.py /
COPY ./movies.py /src/
COPY ./database /database
EXPOSE 5001
CMD python movies.py
CMD python src/movies.py
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment