Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run the Google app engine server using Dockerfile

I'm new to docker, i need to run the web2py application in google app engine server using Dockerfile for this i created the dockerfile to install the python, gae server and my web2py source folder.

my issues are one how to start the gae server using Dockerfile and how to configure the existing source code into gae and how to run the gae server to view the my application landing page on browser based on the docker running container IP

here is my Dockerfile

FROM ubuntu:trusty
MAINTAINER John
#install python
RUN sudo apt-get install python --assume-yes
RUN apt-get install -y wget unzip
#install GAE
RUN wget https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-    sdk.zip && unzip google-cloud-sdk.zip && rm google-cloud-sdk.zip
RUN google-cloud-sdk/install.sh --usage-reporting=true --path-update=true --  bash-completion=true --rc-path=/.bashrc --additional-components app-engine-python 
ENV PATH /google-cloud-sdk/bin:$PATH

COPY Testapp/ . 
RUN pwd 
WORKDIR Testapp
CMD python web2py.py  
#Expose the ports
EXPOSE 8081
ENTRYPOINT ["/Testapp/web2py"]
#CMD ["python", "/Testapp/web2py.py"]
CMD ["/bash/"]
like image 955
Chandu Avatar asked Sep 10 '25 16:09

Chandu


1 Answers

Try:

FROM ubuntu:trusty
MAINTAINER Chandra
#install python
RUN apt-get install -y -qq wget python unzip
#install GAE
RUN wget https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.zip && unzip google-cloud-sdk.zip && rm google-cloud-sdk.zip
RUN google-cloud-sdk/install.sh --usage-reporting=true --path-update=true --bash-completion=true --rc-path=/.bashrc --additional-components app-engine-python
ENV PATH /google-cloud-sdk/bin:$PATH

WORKDIR CFSA_Testapp
COPY CFSA_Testapp/ .
RUN pwd
CMD python guestbook.py
#Expose the ports
EXPOSE 8080
CMD ["dev_appserver.py", "--host=0.0.0.0", "."]

I tested it using Google's example app simply by putting it in CFSA_Testapp folder.

You can run it with docker run -it --rm -p 8080:8080 image_name.

Then you just open your browser on localhost:8080 and you are done.

like image 198
Fuxi Avatar answered Sep 13 '25 05:09

Fuxi