Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example dockerfile with simplest possible python server
FROM gliderlabs/alpine:3.4
ENV PORT 80
RUN apk-install python
ADD . /app
WORKDIR /app
CMD python /app/server.py
EXPOSE 80
#!/usr/bin/python
# This file is only provided as an example on how to organize your services.
# Delete it when starting to implement your service code.
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import os
PORT = int(os.environ['PORT'])
class Handler(BaseHTTPRequestHandler):
# Handler for the GET requests
def do_GET(self):
self.send_response(200)
self.end_headers()
self.wfile.write("Hello World!")
return
server = HTTPServer(('', PORT), Handler)
print 'Started HTTP server on port', PORT
server.serve_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment