Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial Simple App #1

Merged
merged 1 commit into from
Mar 29, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# PyCharm settings
.idea

# Our Python environment
env27
env34

# Compiled Python
*.pyc
39 changes: 39 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM ubuntu:14.04

# Install the packages we need for getting things done
RUN apt-get update && \
apt-get install -y \
build-essential \
dos2unix \
git \
&& \
apt-get clean

# Install the packages we need for Pyramid
RUN apt-get update && \
apt-get install -y \
python3-pip \
&& \
apt-get clean

# Install the Python packages we need
COPY requirements3.txt /tmp/requirements3.txt
RUN pip3 install -r /tmp/requirements3.txt && \
rm /tmp/requirements3.txt

# Install our source
COPY tractdb_pyramid.py /tmp/tractdb_pyramid.py

# Port where Pyramid will listen
EXPOSE 8080

# Volume for secrets
VOLUME ["/secrets"]

# Our wrapper script
COPY run.sh /tmp/run.sh
RUN dos2unix /tmp/run.sh
RUN chmod a+x /tmp/run.sh

# Run the wrapper script
CMD ["/tmp/run.sh"]
3 changes: 3 additions & 0 deletions requirements3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nose
pyramid
PyYAML
5 changes: 5 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

# Launch our server, making it the process to ensure Docker behaves
# http://www.projectatomic.io/docs/docker-image-author-guidance/
exec python3 /tmp/tractdb_pyramid.py
22 changes: 22 additions & 0 deletions tractdb_pyramid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response


def yo_world(request):
return Response('Yo')


def main():
config = Configurator()
config.add_route('yo', '/')
config.add_view(yo_world, route_name='yo')
app = config.make_wsgi_app()
return app


if __name__ == '__main__':
app = main()
server = make_server('0.0.0.0', 8080, app)
print('Starting up server on http://localhost:8080')
server.serve_forever()